TextBlock and Vector3 projection

Hi. I am using Vector3.Project to track the screen position of a bunch of vectors on the x axis and use the screen coordinates to update textblocks. Here is a playground:
https://www.babylonjs-playground.com/#YPLJH5
However after a certain camera angle, textblocks appear where they shouldn’t…
I tried to display on screen the coordinates of one of them and it seems when it’s off screen (e.g. coordinates are bigger than canvas dimensions) they grow indefinetely to crazy numbers and then return from negatives to reasonable screen coordinates so they appear even if they shouldn’t.
Can someone help me ?
Edit: I also saw then when radius is big enough they don’t appear regardless of camera angle

You should cull the points before projecting them because I think the projection computation will (may) fail if the point is not in the camera frustum:

https://www.babylonjs-playground.com/#YPLJH5#2

1 Like

Wow! Great… I didn’t know about isInFrustum… that’s very useful. Thank you