mrdoob / three.js

JavaScript 3D Library.
https://threejs.org/
MIT License
103.02k stars 35.41k forks source link

Camera rotation #670

Closed nosy-b closed 13 years ago

nosy-b commented 13 years ago

Hello, I've seen many questions about it but no answer using NO target.

I'm in the center of a panoramic. As i do stuff with laser cloud navigation i first want a simple independent camera that can rotate around it's own position. camera.rotation.y works fine. But if I add a rotation on x it's a mess as it doesn't make the camera change it's local frame of reference after the first rotation. So a rotation around X from 45° then on Y 45° too will tilt the camera. For other Object3D there is not this problem, rotations are done using the last local coordinate system. Why does the camera react like that? (All its rotations are done using the global frame of reference)

I tried many different solution, I don't get it so if you have any ideas :) thanks!

mrdoob commented 13 years ago

Not sure I understand the problem... ?

nosy-b commented 13 years ago

For example let's say i m in the center of a sphere textured with an equirectangular picture. I would like to look a bit on the right and a bit on the sky, up. I first do the camera rotation on y. Ok I look on the right. Then i do the rotation on x. It does turn around the old X axis from the initial position of the camera (idendity matrice), the global reference frame.I don't look a bit up but i look titled.

mrdoob commented 13 years ago

I would use lat/long+lookAt() instead of trying to fight with euler rotation orders and stuff. Like in this example:

http://mrdoob.github.com/three.js/examples/webgl_panorama_equirectangular.html