Set camera look vector from roll, pitch and yaw values?
See original GitHub issueWhen 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?
Issue Analytics
- State:
- Created 12 years ago
- Comments:21 (7 by maintainers)
Top Results From Across the Web
How to get camera up vector from roll, pitch, and yaw?
You can use this for looking up values, invoking methods, or whatever. So if you have a transformation matrix and you wanted to...
Read more >Camera - LearnOpenGL
The pitch is the angle that depicts how much we're looking up or down as seen in the first image. The second image...
Read more >Camera - SwiftGL
The pitch is the angle that depicts how much we're looking up or down as seen in the first image. The second image...
Read more >Finding pitch/yaw values from lookat vector
I have a camera class that contains a position, a pitch, and a yaw (the pitch and the yaw correspond to y and...
Read more >Finding camera up with yaw, pitch and roll? - Processing forum
up.x = cos(cam.getRotations()[0])*sin(cam.getRotations()[1]); up.y = -cos(cam.getRotations()[1]); up.z = sin(cam.getRotations()[0])*sin(cam.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Camera always look at 0,0,0? You must have a
camera.lookAt()overriding your rotation somewhere in your code.I found this library http://www.c3dl.org/index.php/tutorials/tutorial-9-camera-basics/ and I see that it can set camera’s roll, pitch and yaw values.
How to do this with Three.js?