How do I get 2d coordinates from a 3d scene?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By jbko6

I’m not really sure how to word this, but essentially I want to find the 2d position of a 3d object on the screen. I’m trying to a make system that creates a 2d rectangular overlay using a control over a 3d object, but I’m not sure how to create a system that places the rectangle. So, how could I make a script that creates a GUI rectangle over a 3d cube?

:bust_in_silhouette: Reply From: jbko6

Nevermind, after lots and lots of digging I found out about camera.unproject_position(Vector3) from another page! :slight_smile:

2 Likes
:bust_in_silhouette: Reply From: abhinavsingh

var answer = $Camera.unproject_position($box.get_translation())
print( answer )
$Sprite.position = Vector2(answer )