[ODE] Re: rotation matrix from normalized vector?

Aras Pranckevicius nearaz at interamotion.com
Tue Mar 11 01:59:01 2003


> to that body. Then I want to position another body at the point where
> force
> is applied. And I want the rotation of that other body to be dependent on
> the orienation of the force vector.

Well - there's no single solution. Your body will face the force vector, but
it's orientation along the force axis isn't determined. So you'll have to
think of some way to determine the rotation around that axis.

For the matrices: the rotation matrix is nothing more than 3 (usually
perpendicular and normalized) axis vectors, that together make a coordinate
system (coupled with 'position' vector they form a 'body local' coordinate
system).

The matrix is laid out as this (mey be transposed. This is how it's in D3D.
Don't know if it's the same in ODE, or it's transposed):
Xx Xy Xz
Yx Yy Yz
Zx Zy Zz

Here X,Y,Z are your axis vectors, and x,y,z are components of those. Say, my
"front" vector is the Z (and X is the 'side', Y is the 'up'). So I just
write it into the matrix. You'll have to think of some way of expressing one
of the rest vectors though, say, the 'up' vector. Then the 'side' is just a
cross product of the other two.


 Hope that helps,
Aras Pranckevicius aka NeARAZ
http://www.gim.ktu.lt/nesnausk/nearaz/