Sign in to follow this  
afraidofdark

quaternion - orientation - shaking problem

Recommended Posts

afraidofdark    278
hello, here is my situation, I want my plane fly I have a unit direction vector (udv) and two quaternions(qx qy) which represents rotation on the x and y axis. I multiply "qx" and "qy" to achive and effect (eq) than I multiply "eq" with "udv" to orient "udv" to desired direction. then I normalise "udv" and multiply it by a scalar(my plane's speed) then I add "udv" to plane's position. Every think is ok up to here. when I apply my orientation(which is qx*qy) to the plane, plane is start shaking I tried slerp to solve problem but it didnt help. why is this happening ? an interpolation problem or a floating point problem ? or what ever is this ? what I did briefly udv = my direction vector qx = rotation on x axis qy = rotation on y axis qe = desired rotation plane = plane object oldPos = plane's old position qe = qx*qy; udv = qe*udv; udv.normalise(); udv *= speed; plane.setPosition(oldPos plus udv); plane.setOriantation(qe) -> plane is shaking soryy for my English [Edited by - afraidofdark on November 22, 2008 6:34:29 AM]

Share this post


Link to post
Share on other sites
Stani R    1070
First, you can skip on some operations by storing the rotations in just one quaternion instead of two separate ones. But that is probably not the source of the problem.

I'm not sure what exactly you mean by shaking, but could it be due to how you are setting the plane's position? I mean, do you really want to set the position to the scaled direction vector? Wouldn't that mean that if I am traveling away from the origin and slow down, I am suddenly jumping backwards in the direction of the origin? Position and direction are usually two separate beasts.

Share this post


Link to post
Share on other sites
afraidofdark    278
Quote:
Original post by lightbringer
I'm not sure what exactly you mean by shaking, but could it be due to how you are setting the plane's position? I mean, do you really want to set the position to the scaled direction vector? Wouldn't that mean that if I am traveling away from the origin and slow down, I am suddenly jumping backwards in the direction of the origin? Position and direction are usually two separate beasts.


by shaking I mean plane is quickly going back,forward,left,right and as long as travelled distance increase, shaking becomes stronger so I think that this was a floating point problem

and I acctualy dont add scaled direction vector to the planes position

Iam doing it by this way

plane.setPosition(plane's old position plus scaledDirection)

and I dont know how can I store two diffrent quaternion in one

I olso tried to do every rotations in rotation matrix as well (to understant if this happening because of quaternion but results were identical)

thank you for your suggestions

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this