Reputation: 57
I use release 116. First I change the camera position, and then I try to get the projection of the vector (something like this: vector. project(camera)), then I call the scene render and get an incorrect projection value. If I call the scene render again and recalculate the projection value, I get the correct value. I also get the correct value if I call render after changing the camera position. I don't understand why I need to render to get the correct projection of the vector. If there is another way? Thank you for any advice.
Upvotes: 1
Views: 119
Reputation: 31036
It seems the camera's internal matrices are not up-to-date when you are using Vector3.project()
. Try to use the following approach to fix the issue:
camera.updateMatrixWorld();
vector.project(camera);
Upvotes: 0