Game Development Community

Does the MatrixF inverse() function work?

by Josh Albrecht · in Torque Game Engine · 09/29/2001 (7:16 am) · 1 replies

It never seems to do anything to my matrix... :(
My matrix looks like this:

# # # #
# # # #
# # # #
0 0 0 1

# = some float number

Please just give me some example code (suing Torque) that works for you, and creates the inverse of a matrix structured like the one above. Sorry, I am probably missing something BLATANLY obvious, but I cant find it. Just in case you want, here is my code:

MatrixF mat;
MatrixF renderTransform = getRenderTransform();
MatrixF pointTransform = getNodeTransform("Bip01 L Forearm");
mat.mul(renderTransform, pointTransform);

Box3F Box;
Box.min.set(-1,-1,-1);
Box.max.set(1,1,1);

Point3F start;
start.set(0,0,0);
Point3F end;
end.set(10,0,0);
pointTransform = getNodeTransform("Bip01 L Forearm");
mat.mul(renderTransform, pointTransform);
mat.mulP(start);
mat.mulP(end);

pointTransform = p->getNodeTransform("Bip01 Pelvis");
//pointTransform = pointTransform.inverse();
//that line didnt seem to work...
//pointTransform.fullInverse();
//and neither did the one above.
MatrixF tod = pointTransform.inverse();
//this one doesnt seem to work either
tod.mulP(START);
tod.mulP(END);
Box.collideLine(START, END);


Any suggestions?

#1
09/29/2001 (8:37 am)
Never mind, i figured it out. I had to take the inverse of the nodetransform AND the rendertransform (the two matrices I originally multiplied the point by)