I am trying to make a model in which you can select faces ( and they change color/separate from the model). What I am trying to do now is to get a vertice from my selected face and project those coordinates into the screen. I have searched around but most of the questions I've found use deprecated functions. I do realize this question may seem like a duplicate but I haven't found nothing that solves my problem. I am trying to use the project function from THREE.Vector3 but the coordinates I get are always wrong.
This is the relevant part of the code I am using:
var startPoint = mesh.geometry.vertices[selectedPoly.a].clone();
startPoint.project(camera);
startPoint.x = (startPoint.x + 1) / 2 * window.innerWidth;
startPoint.y = ( -startPoint.y - 1) / 2 * window.innerHeight;
I am just trying to reverse what I do to get a mouse click in 3d space. I am probably doing something wrong. Could you please give me a hand?