cwisbg
Hey everyone! I have looked, dived into scenes and searched the forum but am still unable to get this to work.

How would I go about turning off/on a constraint using a bounding box object?

I feel like im close but I figured I would ask for a little guidance from the masters. Thank you in advance for any help on this one!

Attached is a scene with a basic setup.
Reply 0 0
plarson
The attributeTransfer1.weight is the check box under Attributes. It won't output weight values based on the bounding. The Attribute Transfer's outWeightPP outputs a float array the size of the inGeometry's point count. Since the parentConstraint works on the object level, its weight value is expecting a single float. One thing you could do is put an expression on the parentConstraint, doing a getAttr on the attributeTransfer1.outWeightPP, then use one of the values in that array to set the parentConstraint weight.
Reply 0 0
pshipkov
I don't think you need bounding object for that really, but a simple expression.
If A is closer than B than some threshold value (100 in this case) turn on the constraint otherwise turn it off
if(mag(<>) <= 100)
parentConstraint.weight0 = 1;
else
parentConstraint.weight0 = 0;
Notice that this calculation is performed in local space, so if you parent the objects under other transforms and move the other transforms around this will not be accounted for.
Use the xform command to take care of world space transformations.
Reply 0 0
Reply