[Bf-committers] Armatures for beyond Release 2.4

Brecht Van Lommel brechtvanlommel at pandora.be
Fri Dec 23 20:12:15 CET 2005


Gilbert, Joseph T. wrote:
> Thx Brecht :) This is useful info and I think we can apply it.
> It would be nice to have a mat3_to_vec_roll in there somewhere that way
> I wouldn't have to figure it out :)

Here you go:

/*  Computes vector and roll based on a rotation. "mat" must
     contain only a rotation, and no scaling. */
void mat3_to_vec_roll(float mat[][3], float *vec, float *roll)
     if (vec)
         VecCopyf(vec, mat[1]);

     if (roll) {
         float vecmat[3][3], vecmatinv[3][3], rollmat[3][3];

         vec_roll_to_mat3(mat[1], 0.0f, vecmat);
         Mat3Inv(vecmatinv, vecmat);
         Mat3MulMat3(rollmat, vecmatinv, mat);

         *roll= atan2(rollmat[2][0], rollmat[2][2]);

That should fit nicely in armature.c, but not committing it
now due to the freeze.


More information about the Bf-committers mailing list