Always Display UI Label Linked with mesh

Hello Again everyone!

After searching in the forums for a while, I was trying to find a way to -always- display a label or UI Element that is linked to a mesh inside a scene, even if the mesh is outside the view: in example, when you rotate the camera in such a way the sphere is out of view, the tracking label goes away with it, In our case we desire to keep it on the screen borders until the user finds it again.

Here is the playground.

Controls: WASD and Mouse scroll

Bonus points if there is a way for the UI line to -never- disappear even if its behind you haha.

I wonder if there’s a function I am missing…

Nope, there’s no ready function for this case, so you’d have to customize your own. You can see how it’s done normally here: Babylon.js/packages/dev/gui/src/2D/advancedDynamicTexture.ts at master · BabylonJS/Babylon.js (github.com), so your version would have to check the resulting left/top positions to see if its outside the viewing rectangle (which depends on the size of the screen)