Help needed with passing the angle of movement from an animation of a camera to a 2D sprite shader. Trying to project two vectors to the camera and compute the angle, but encountering issues.
let prevCameraVector = null;
function tick() {
if(prevCameraVector && !prevCameraVector.equals(camera.position)) {
let vector1 = prevCameraVector;
let vector2 = new THREE.Vector3(camera.position.x, camera.position.y, camera.position.z);
vector1.project(camera);
vector2.project(camera);
let angle = vector1.angleTo(vector2);
uniforms.uRotate.value = angle;
}
prevCameraVector = new THREE.Vector3(camera.position.x, camera.position.y, camera.position.z);
}