I'm trying to position a text object on a 2D layer that stays above a 3D object on the screen as the camera moves around freely. (Think player nameplates in a game, for example)
I have it working using 3DCamera.LayerToCanvas, but if the window is resized from its original viewport resolution, it messes up the positioning so it's still not quite right. I figured maybe I'm doing something wrong. What am I missing?
I made a quick example project to show what I did. Run a preview and move with the arrow keys. Resize the window and you can see the issue with the text I'm trying to solve.
Any corrections or solutions are appreciated! Thanks.
Develop games in your browser. Powerful, performant & highly capable.
I figured it out. I didn't realize that function wouldn't scale the coordinates for me. Getting the canvas size using platform info allowed me to scale it, which is what I was missing.
I'll upload the solution too in case it helps anybody else who runs into this.