Click to See Complete Forum and Search --> : Quaternions and orientation


fezztah
May 19th, 2006, 01:41 PM
Hi, im working on a 3D particle system and one of the things im trying to do is throw out mesh particles (models) that align with the direction of motion. An example would be a fountain of arrows all pointing in the correct direction as the arc over. Im sure everyone must run into this but cant find anything on it.

I have a 3x3 orientation matrix for my model and a current particle direction vector (xyz). So how do I update my model orientation to stay aligned with the changing particle direction vector?

Initially I was using the direction vector to create an orientation matrix directly and then concatenating that onto the model matrix. It worked but suffers from gimbal lock when the orientation inverts which random particles have a habit of doing.

Im pretty sure quaternions are the answer, in the past ive used them to slerp from one orientation to another very successfully but this isnt quite the same.

nolxev
May 20th, 2006, 03:26 PM
If you need a object that rotate around a vector (I mean a direction that can be changed) the way to go would be the quaternions, create a rotation by quaternion around that vector and update it if the direction change (the vector change).