+2 votes

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).

in Engine by (45 points)

1 Answer

+3 votes
Best answer
var positionOnScreen = camera.unproject_position(spatialNode.get_global_transform().origin)

Hope this is what you are looking for :)

by (1,285 points)
selected by

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.

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 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.