10 October 2005, 09:51 PM
The pointMatrixMult procedure is not recommended to be used in expressions. What happens is, every time you call it, it creates a pointMatrixMult node, and then uses setAttr and getAttr on the inputs to return the transformed point (it also returns the wrong answer by default since it sets the operation to vector matrix multiply, not point matrix multiply, but in your case, you probably want vector matrix multiply anyway). Before the procedure ends, it deletes the node. This means that it will create and delete a node every time the expression executes.
This could be why maya crashes, I'm not sure, but regardless, it's not a very efficient way of doing things.
What you should do is open the hypergraph or hypershade and create either a pointMatrixMult node or a vectorProduct node and set its operation to Vector Matrix Product, then connect R_Clavicle's worldMatrix attribute to matrix attribute of the pointMatrixMult or vectorProduct node, and change the expression (assuming you've created a vectorProduct node):
float $RShoulderLoc = `joint -q -p -a R_Shoulder`;
$worldVector = (R_Arm_IK.translateY - $RShoulderLoc) * -1;
$worldVector = (R_Arm_IK.translateX - $RShoulderLoc);
$worldVector = 0;
vectorProduct1.input1X = $worldVector;
vectorProduct1.input1Y = $worldVector;
vectorProduct1.input1Z = $worldVector;
R_Arm_IK.poleVectorX = vectorProduct1.outputX;
R_Arm_IK.poleVectorY = vectorProduct1.outputY;
R_Arm_IK.poleVectorZ = vectorProduct1.outputZ;
In fact, you could build up the entire expression with a node network - use a decomposeMatrix node with R_Shoulder's worldMatrix attribute as input to get its translation in world coordinates, and use simple plusMinusAverage and multiplyDivide nodes to get the results of lines four and five of the expression and connect the outputs into the vectorProduct node, the output of which can be connected directly into the poleVector attribute of R_Arm_IK. Simple, fast, and stable.
10 October 2005, 07:14 AM
Thank you Anders!!!
You're right, that fixes the problem. All is well now. You truly are a "know it all". :)
I haven't done too much with node networks - I always assumed they were intended for use with shaders, and I guess they are but now I realize you can use them for other purposes as well... very interesting.
10 October 2005, 07:58 AM
Lol, I wouldn't go that far, That user title is just what you're rewarded if you post 300 times here :)
Yes, node networks are great, they're one of the main things which make maya so powerful. They're especially great for character setup when you need a visual representation of the rig "engine" without having to look through a wad of expressions.
10 October 2005, 07:58 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.