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

trueSpace Scripting Selection

Space.Select() – select multiple nodes from text string separated by semi colons, node paths in the list must not have leading spaces

Node.Selection() – returns a selection list with a semicolon delimination, but has leading spaces in each nodes path so needs to be adjusted to work with Space.Select

sel = Node.Selection();
selArray = sel.split(";");
re = /^\s/; // whitespace in first character position
sel = selArray[0].replace(re,"");
if(selArray.length > 1)
	for(i=1;i<selArray.length;i++)
		sel = sel + ";" + selArray[i].replace(re,"");

Node.Select – select one node

Space.Unselect()