Can anybody make it clear to me why i am getting like {x:Infinity, y:-Infinity, z:-Infinity} from my position values like {x:0.50516157, y:-0.62950189, z:0} when i am trying to project my position vector onto the camera. I have found a similar query Converting World coordinates to Screen coordinates in Three.js using Projection on this but the solution does not solve my problem. It would be really help full and time saving if someone can help me.
var screenvector = new THREE.Vector3();
var position = new THREE.Vector3();
position = convertLatLontoVec3(lat, lng).multiplyScalar(radius);
//convertLatLontoVec3(returns new THREE.Vector3(x, y, z);)
screenvector.copy(position);
//till here during debugging i can find the values of position.x, .y, .z
screenvector.project(camera); //But once this step is executed all the values are becoming infintiy. I don't understand why is it happening.
camera.projectionMatrix
and whethercamera.matrixWorld
is invertible (that isnew THREE.Matrix4().getInverse(camera.matrixWorld)
) we cannot answer you without knowing how your camera is set up – Derte Trdelnik