3D to 2D, screen x and y

Hi guys, I need to move an entity containing a text and a background png image (circle), very similar to this, my 3d object will be static, I will just move the camera over it, can someone give me an idea of how to start, if I do this trying to use that entity as a son of the camera, or in the HUD 2d.

Hi @vgupgrade,

A good starting point is the worldToScreen camera method. In this method you can pass a world position and get back screen coordinates to position your UI element:

https://developer.playcanvas.com/en/api/pc.CameraComponent.html#worldToScreen

And here is an example project:

https://developer.playcanvas.com/en/tutorials/world-to-ui-screen-space/

man, this is ready, thank you sir.

1 Like

Hey, I worked on Forces of Freedom! :laughing: Never thought I see this game here

2 Likes

That is a screenshot of a PUBG Mobile, though :slight_smile:

1 Like

Whoops. You can see the similarities though right? :grimacing:
image

2 Likes