View Full Version : connect a variable to an attribut


lutinbis
08 August 2007, 09:26 AM
I would like know how I can connect a float variable in an attribut.
not with setAttr, beacause the variable will change .

exemple:

$dist is a float value of a distance between 2 joints calculate with vectors
the distance will change when joints move.
and I will connect the float distance in a multiplyDivide.


think you :)

trancor
08 August 2007, 05:07 PM
I think the only way you're going to be able to do this is by making another channel on an object that has an expression to get the difference between the distances. Then when you want to link it up with the multiply divide node, you'd need to load up the object and connect that channel to the mult/div node.


Other than that you could set a global variable in an expression and instead of having anything connect into the multi div node, just do the multiplication in the expression and call up the variable by the objects you are trying to have the variable used by.


The channel on an object would need to be a setAttr, but if you getAttr for the translation of the two joints you would simply do the math in a global float $dist=mag($vector2 - $vector1);

I hope I could be of some help for you, but for what it looks like you want to do, you'll need to make a work around for it. Good luck.

tbaypaul
08 August 2007, 10:22 PM
Another alternative is to just use a distance node with the output piped over to the attribute. You parent the dist node locators to the joints or a point constain them.

CGTalk Moderation
08 August 2007, 10:22 PM
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.


1