0 votes
func _forward_canvas_draw_over_viewport(viewport_control):
    var pos = terr.position

This code draws a circle in the editor viewport just in the (0,0) of the viewport, aka the upper left corner.

terr.position # returns the position on canvas

I'm going to make a plugin that allows to create polygonized terrain, and polygon2D is not an option.
I want toI draw the circle directly on the node gizmo in the viewport editor, for example. How to get the position in editor viewport?

thank you

Godot version Godot 4.a8
in Engine by (68 points)

1 Answer

0 votes

You could try using


this should give you the global position of the center of the screen as shown at the time,

by (3,321 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.