This is a question about accessing OwnerMatrix values of a joint, or it's OwnerMatrix output. I know they have Matrix values, but I can't export these, and using them to drive anything else makes it very hard to pinput, because it's a WldMatrix, which depends on the world - not local Matrix.
Ideally I would like to pull Local Matrix (OwnerMatrix) values from a bone or joint or IK handle to then use those Matrix values to drive other things, like other object matrixes or morph targets or things of the sort.
How could I do this in Javascript or with nodes? Are trueSpace WS rigs strictly WldMatrix based?
trueSpace - convert Joint Matrix to OwnerMatrix - how?
- Draise
- Captain
- Posts: 3198
- Joined: 21 Sep 2009, 19:33
- Type the number ten into the box: 0
- Location: Bogota, Colombia
- Contact:
Re: trueSpace - convert Joint Matrix to OwnerMatrix - how?
I can use Clintons Point Constraint script and his new Bake tool, then unhook and render away the rigs that are baked, and use the constrainor to drive the morphs or other matrices - but the workflow I find.. a bit cumbersome. I have to bake, unhook, pre-render, rehook, animate, bake, unhook, pre-render, rehook, modify animation, bake, unhook, pre-render.. a very drawn out workflow.
Aren't there procedural clips? Can't the constraint animation be keyframed into one of those so the renderer works without the script errors?
Aren't there procedural clips? Can't the constraint animation be keyframed into one of those so the renderer works without the script errors?
- clintonman
- Captain
- Posts: 5422
- Joined: 21 May 2009, 21:08
- Type the number ten into the box: 0
- Location: California
- Contact:
Re: trueSpace - convert Joint Matrix to OwnerMatrix - how?
You can use the WldMatrix of the parent and child nodes to get the child node local matrix with some math.
Attached script:
select a joint and run it, creates parented cubes to show that the local matrix is correctly calculated.
Edit: Oops, forgot to attach it
Code: Select all
parentMat = Node.Value(theparentjoint, "WldMatrix");
parentMatInv = parentMat.Invert();
childMat = Node.Value(thechildjoint, "WldMatrix");
childMat.Mult(parentMatInv);
//childMat now holds local matrix
select a joint and run it, creates parented cubes to show that the local matrix is correctly calculated.
Edit: Oops, forgot to attach it
- Attachments
-
- local joint matrix.zip
- (3.31 KiB) Downloaded 278 times
Re: trueSpace - convert Joint Matrix to OwnerMatrix - how?
There is a tS761B8.zip\sdk_tS761B8\Examples\RsAnimPlugin\Release\RsAnimPlugin.rsx
Activities extend functionality of nodes. Activity nodes can perform actions and modify object-constraint graph in the way the commands do. They have to implement IRsCommand interface that is used to execute requested actions by calling IRsCommand::Execute method. Activity nodes may combine container and function features of nodes and ability to modify content into one unit, making them ideal candidates for building complex behaviors. Activities are connected to each other using topological connections called control-flow links.
Procedural clip activity node:
Activities extend functionality of nodes. Activity nodes can perform actions and modify object-constraint graph in the way the commands do. They have to implement IRsCommand interface that is used to execute requested actions by calling IRsCommand::Execute method. Activity nodes may combine container and function features of nodes and ability to modify content into one unit, making them ideal candidates for building complex behaviors. Activities are connected to each other using topological connections called control-flow links.
- Draise
- Captain
- Posts: 3198
- Joined: 21 Sep 2009, 19:33
- Type the number ten into the box: 0
- Location: Bogota, Colombia
- Contact:
Re: trueSpace - convert Joint Matrix to OwnerMatrix - how?
Wow, thanks for this.clintonman wrote:You can use the WldMatrix of the parent and child nodes to get the child node local matrix with some math.
Attached script:Code: Select all
parentMat = Node.Value(theparentjoint, "WldMatrix"); parentMatInv = parentMat.Invert(); childMat = Node.Value(thechildjoint, "WldMatrix"); childMat.Mult(parentMatInv); //childMat now holds local matrix
select a joint and run it, creates parented cubes to show that the local matrix is correctly calculated.
Edit: Oops, forgot to attach it
I didn't experiment deep enough, but in theory, I put the WldMatrix values of the parent joint in the parent cube then the WldMatrix values of the child joint into the child cube, and that will give me the OwnerMatrix of the child (when I export it?)
- clintonman
- Captain
- Posts: 5422
- Joined: 21 May 2009, 21:08
- Type the number ten into the box: 0
- Location: California
- Contact:
Re: trueSpace - convert Joint Matrix to OwnerMatrix - how?
First step is to get the WldMatrix of the selected joint and WldMatrix of it's parent joint.Draise wrote:Wow, thanks for this.clintonman wrote:You can use the WldMatrix of the parent and child nodes to get the child node local matrix with some math.
Attached script:Code: Select all
parentMat = Node.Value(theparentjoint, "WldMatrix"); parentMatInv = parentMat.Invert(); childMat = Node.Value(thechildjoint, "WldMatrix"); childMat.Mult(parentMatInv); //childMat now holds local matrix
select a joint and run it, creates parented cubes to show that the local matrix is correctly calculated.
Edit: Oops, forgot to attach it
I didn't experiment deep enough, but in theory, I put the WldMatrix values of the parent joint in the parent cube then the WldMatrix values of the child joint into the child cube, and that will give me the OwnerMatrix of the child (when I export it?)
Second is to use that to compute the selected joint Matrix value.
Here it is without the extra stuff. The cubes were just for demonstration. At the end you get the Matrix value of the selected joint
Code: Select all
function Execute(params)
{
childJoint = Node.FirstSelected();
if(!childJoint) return;
if(Node.ConExists(childJoint, "Joint")) {
System.Trace("child: " + childJoint);
} else return;
parentJoint = Node.LinkedInputNode(childJoint,"Bone",0);
if(Node.ConExists(parentJoint,"Root")) {
parentJoint = Node.LinkedInputNode(parentJoint,"Root",0);
} else {
parentJoint = Node.LinkedInputNode(parentJoint,"Bone",0);
}
if(!Node.ConExists(parentJoint, "Joint")) {
if(Node.ConExists(parentJoint, "Skeleton") && Node.SubObjectCount(currentpath) == 0) {
return;
}
parentJoint = Node.LinkedInputNode(parentJoint,"Root",0);
}
parentMatrix = System.CreateDO("Math Package/Matrix Float Data");
parentMatrixInverse = System.CreateDO("Math Package/Matrix Float Data");
childMatrix = System.CreateDO("Math Package/Matrix Float Data");
parentMatrix = Node.Value(parentJoint, "WldMatrix");
parentMatrixInverse = parentMatrix.Invert();
childMatrix = Node.Value(childJoint, "WldMatrix");
childMatrix.Mult(parentMatrixInverse);
//childMatrix === Matrix for the selected joint
}