Rotate camera around axis
21 October 2016 02:05
Hello again:
I've been trying to rotate a STATIC type camera along the y-axis, the front axis, with the new way to call it. (up-down, x-axis, left-right, z-axis). Well, I wanted to rotate around and I have found is imposible, at least to me.
I have tried via a quaternion and the transform api:
If I use the other axis it works ok, but with the y axis doesn't work. Is this a limitation of the camera or I am doing something wrong?
I've been trying to rotate a STATIC type camera along the y-axis, the front axis, with the new way to call it. (up-down, x-axis, left-right, z-axis). Well, I wanted to rotate around and I have found is imposible, at least to me.
I have tried via a quaternion and the transform api:
var _cam_quat = m_trans.get_rotation(_cam, _vec4_tmp2);
m_quat.rotateY(_cam_quat, _my_rot_y, _cam_quat);
m_trans.set_rotation_v(_cam, _cam_quat);
If I use the other axis it works ok, but with the y axis doesn't work. Is this a limitation of the camera or I am doing something wrong?
21 October 2016 16:05
ello again:Hello!
I've been trying to rotate a STATIC type camera along the y-axis, the front axis, with the new way to call it. (up-down, x-axis, left-right, z-axis). Well, I wanted to rotate around and I have found is imposible, at least to me.
I have tried via a quaternion and the transform api:
var _cam_quat = m_trans.get_rotation(_cam, _vec4_tmp2);
m_quat.rotateY(_cam_quat, _my_rot_y, _cam_quat);
m_trans.set_rotation_v(_cam, _cam_quat);
If I use the other axis it works ok, but with the y axis doesn't work. Is this a limitation of the camera or I am doing something wrong?
Your code snippet looks correct. But if I understand you right, you want roll rotation (wiki), which is rotation around z axis in camera's local coordinate space.
Also make sure that the camera is really STATIC, roll rotation isn't supported for all camera types. Do you change camera type dynamically?
You as well may rotate camera with m_transform.rotate_z_local method, which performs almost the same routine.
21 October 2016 20:45
Hi:
Yes, it is roll rotation. Along the local z axis of the camera. What I've found is that when I use the y parent rotation and add it to the quaternion via rotateAxis if I use any of the other axis works and the camera rotate but in the wrong direction.
I keep trying…
But if I understand you right, you want roll rotation (wiki), which is rotation around z axis in camera's local coordinate space.
Yes, it is roll rotation. Along the local z axis of the camera. What I've found is that when I use the y parent rotation and add it to the quaternion via rotateAxis if I use any of the other axis works and the camera rotate but in the wrong direction.
I keep trying…
24 October 2016 09:56
24 October 2016 21:17