0 votes
func _forward_canvas_draw_over_viewport(viewport_control):
    var pos = terr.position
    viewport_control.draw_circle(pos,60,Color.ALICE_BLUE)

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 (64 points)

1 Answer

0 votes

You could try using

get_camera_screen_center()

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

by (1,683 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 webmaster@godotengine.org with your username.