Rotate camera relative to its right/top/front vector

Software: Away3D 4.x

xynsei, Newbie
Posted: 18 January 2013 12:58 PM   Total Posts: 10

Edit: feel so stupid for missing this in docs… pitch(angleX), yaw(angleY), roll(angleZ); http://away3d.com/livedocs/away3d/4.0/away3d/core/base/Object3D.html

—-

Is there a built in way of doing this or perhaps some example code? I have some controls and all is well while i rotate only on x or y alone but if i have x to 90, y rotation looks like rotating on z.

   

Avatar
Fabrice Closier, Administrator
Posted: 18 January 2013 04:24 PM   Total Posts: 1265   [ # 1 ]

this has a name: http://en.wikipedia.org/wiki/Gimbal_lock
Fix is to use Quaternion class and multiply a q from old matrix with rotation Q. Then set the resulting matrix as transform to camera.

   

xynsei, Newbie
Posted: 18 January 2013 06:36 PM   Total Posts: 10   [ # 2 ]

Newbie tag suits me lol… so what is q from old matrix? I found this article will try to apply it http://www.cprogramming.com/tutorial/3d/quaternions.html

   

xynsei, Newbie
Posted: 18 January 2013 09:08 PM   Total Posts: 10   [ # 3 ]

I found that there is a rotate(axis:Vector3D, angle:Number):void methond but it provides same results.

camera.rotate(camera.forwardVector,angle);

should always result in what looks like a 2d rotation it however does so only if no other rotations have been made. Is that a bug or i don’t understand the difference?

—-

Edit: Vector3D.Y_AXIS != Object3D.upVecotr that makes it clear

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X