Here is some code to check when a cylinder enters a bounding box of a group of cubes. When it enters it prints a word, what I need is for it to record when it exits aswell.
Code:
int $objectIsInside;// on/off switch float $cylBBox[] = `xform -q -ws -boundingBox pCylinder1`;// cylinder's BBox float $cubeBBox[] = `xform -q -ws -boundingBox group1`;// group's BBox if ( ($cylBBox[0] < $cubeBBox[0]) && ($cylBBox[2] > $cubeBBox[2]) ||//check X BBox ($cylBBox[3] < $cubeBBox[3]) && ($cylBBox[5] > $cubeBBox[5]) ||//check Y BBox ($cylBBox[3] < $cubeBBox[3]) && ($cylBBox[4] > $cubeBBox[4]) ||//check Z BBox ($cylBBox[2] < $cubeBBox[2]) && ($cylBBox[0] > $cubeBBox[0]) ||//check -X BBox ($cylBBox[4] < $cubeBBox[4]) && ($cylBBox[3] > $cubeBBox[3]) ) //check -Z BBox { if (!$objectIsInside){// if not inside set to yes $objectIsInside = yes;// check if object is in BBox } } else { if ($objectIsInside) // if inside set to no print "entered BBox";// print word $objectIsInside = no;// check if object is in BBox }
Anyhelp with this one would be great as I am not sure how to get it to turn back on.
Thanks, Chris