How to locate my 3d object location in viewport

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By alvin00221
:warning: Old Version Published before Godot 3 was released.

Iam doing 3d game. I want to get vector2d of my 3d object in viewport…

for example:
this enemy is located at Vector3(3,4,5)

then in my viewport
it will return vector2(x,y).

:bust_in_silhouette: Reply From: kubecz3k
var positionOnScreen = camera.unproject_position(spatialNode.get_global_transform().origin)

Hope this is what you are looking for :slight_smile:

Woooww! Thank you very much… this is what i am looking for…hehe!

I am gonna use this for my health bar. i have done different way and now i think this would be the best choice.

alvin00221 | 2016-06-21 01:37