I’m working on the last bit of my HUD, which is placing bars for enemy shield strength above the enemies.
I’m trying to get position I need to place the elements on render2d so they will appear above the enemies. I looked up a mouse picking script involving planes and the camLens.extrude() method that I had used previously and knew worked. That gave me the idea to look at the available methods of camLens for something that would do the opposite of extrude: find the 2d point in the window that corresponds to a point in 3d space.
I found the camLens.project() method which claims to do exactly that. I set up a script to use it, but even when I’ve got the camera pointed right at the point in 3d space I’m trying to sync with, project() claims the point is not in the viewing frustrum and fills my point with nothing useful.
Do I need to specify a viewing frustrum before I can use the project() method? If so, how would I do that for a mobile camera such that it covers everything my camera is feeding to the render window?