trueSpace Scripting Matrix

Matrix multiplication

myMatrix.LoadIdentity();
rollMatrix.LoadIdentity();
yawMatrix.LoadIdentity();

yawMatrix.SetYaw(22);
rollMatrix.SetRoll(13);

last rotation
myMatrix.SetPitch(-90);// myMatrix = -90 deg pitch

(this is the second rotation)
myMatrix.Mult(rollMatrix);// rollMatrix * myMatrix => myMatrix

(this is the first rotation)
myMatrix.Mult(yawMatrix);// yawMatrix * myMatrix => myMatrix

myMatrix is yaw 22 deg then roll 13 deg then pitch -90 deg

Local matrix from world matrices

theMatrix = Node.Value(bindgroup + "/" + subNode, "WldMatrix");
parentMatrix = Node.Value(bindParent, "WldMatrix");
parInvert = parentMatrix.Invert();
theMatrix.Mult(parInvert);

//now theMatrix contains local instead of world

Leave a Reply

Your email address will not be published. Required fields are marked *