When I init my ThreeJS base application I must specify camera target:
camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 2000); camera.position.set(0, 0, 1500); camera.target = new THREE.Vector3(0, 0, 0);
I also have one mesh which I have put on 0,0,0 coordinates.
Now I need to set camera’s rotation based on roll, pitch and yaw values that I receive from my mobile phone and these values are from -PI to +PI.
I tried something like this
camera.rotation.x = roll / Math.PI camera.rotation.y = yaw / Math.PI camera.rotation.z = pitch / Math.PI
but camera would always look at 0,0,0 and I need it to look at place based on roll, pitch and yaw.
How can I accomplish this?