Jump to content
  • Advertisement
Sign in to follow this  
afraidofdark

quaternion - orientation - shaking problem

This topic is 3620 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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
Advertisement
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
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!