How do I get viewport position? (Plugin)

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By ReudsFratt92
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

:bust_in_silhouette: Reply From: Gluon

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,