running command on entry to a bounding box
Ok I have a cylinder moving around a scene, what I would like to do is run a command when the cylinder enters within the bounding box of a stationary cube and when it leaves.
Below is the expression I have so far, it gets the bounding box of each item and prints a word when it is within the same bounding box, at the moment it is only for the worldspace in X.
The problem is, it keeps printing the word when its inside the bounding box rather than just once on entry, any ideaas on how to get this to work?
float $cylBBox = `xform -q -ws -boundingBox pCylinder1`;
float $cubeBBox = `xform -q -ws -boundingBox pCube1`;
if ( ($cylBBox < $cubeBBox) && ($cylBBox < $cubeBBox) )