World position to screen position

How can I convert a position vector in world space to camera space ?
I imagine there must be some function for this, but I haven’t found anything.

To be clear, I know I can get the position of an object in world or screen space, however I’m just trying to convert positions without any existing object.

I also found the getWorldPoint(x,y) method on the camera, so why isn’t there a getCanvasPoint method to do the opposite ?

All I’ve found so far are a few examples that are either out of date, ignore camera rotation, or make use of the matrix attribute of the camera - which is private.

:waving_hand:

I don’t know a function for this either. I did it this way.

https://codepen.io/samme/pen/eYvyZqQ

2 Likes