How to converting world coordinates to 2D mouse coordinates in ThreeJS

vector.project( camera );

This only converts a vector to normalized device space. You still have to map the vector to 2D screen space. Something like:

vector.x = ( vector.x + 1) * width / 2;
vector.y = - ( vector.y - 1) * height / 2;
vector.z = 0;

width and height represent the dimensions of the canvas (renderer.domElement).

6 Likes