# quaternion - orientation - shaking problem

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

## 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 on other sites
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 on other sites
Quote:
 Original post by lightbringerI'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)

1. 1
2. 2
3. 3
Rutin
14
4. 4
5. 5

• 9
• 9
• 11
• 11
• 23
• ### Forum Statistics

• Total Topics
633674
• Total Posts
3013276
×