Lerping quaternions--reversing the lerp direction

I’m lerping between two quaternions (using the equation “result = quat1 + (quat2 - quat1)*percentage”), and am finding that the resultant rotation between the two orientations turns in the opposite direction to my intended rotation (clockwise when I want counter-clockwise and vice versa). Is there a way to reverse the direction of the lerp?

(If not, I’ll probably try specifying a “mid-lerp” orientation, then lerp from quat1 to that middle orientation if the percentage is less than 0.5 and from the middle orientation to quat2 otherwise, which should, I hope, work.)

I’ve tried a few things, but my knowledge of quaternions is a little limited, I fear, and I didn’t manage to find the result that I wanted.

If a quaternion is sort of an axis-angle representation of a rotation, with (w,x,y,z) being the the roll of the vector and the three vector components, what happens if you simply invert the sign of the roll? I haven’t tried this, but I did have some success with modifying quaternions by scaling the “roll” component while working out the process for my controlJoint animation system.

Did you find a solution for this? My suggestion is clearly wrong. :laughing: I did a bit of digging, and found this: http://www.gamedev.net/topic/349626-mirroring-a-quaternion/, where one of the suggestions seems to be what you’re considering. There are various suggested handlings at the link, however.

My apologies that it took me so long to respond!

Thank you very much for your suggestions. :slight_smile:

Unfortunately, it’s still not working–and looking again today at my problem, I have a suspicion that the problem lies with one joint specifically, meaning either that I should be mirroring only that joint (I had been mirroring them all) or that I’m doing something incorrectly with that one joint.

That thread that you linked me to looks as though it has some good advice, so if I do end up mirroring that one joint of mine the thread should be useful. Thank you again. :slight_smile:

I seem to have fixed the problem: First of all, it does seem that it was only that one joint that was giving me trouble, and it looks as though it was related either to the starting orientation or the end orientation. In the end, subtracting my intended rotation (90 degrees) from 360 (thus giving me a rotation of 270 degrees) seems to have resulted in the intended effect.

I’m still not entirely clear on why this was the case, however. :confused: