mrdoob/three.js — Issue #1365: Set camera look vector from roll, pitch and yaw values?
Author: Dino4674
Created: 2012-02-20 20:50:16+00:00
State: open

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 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?