Simply Maya User Community

Simply Maya User Community (https://simplymaya.com/forum/index.php)
-   Programming (https://simplymaya.com/forum/forumdisplay.php?f=32)
-   -   collecting multiple bounding box entries (https://simplymaya.com/forum/showthread.php?t=31603)

bendingiscool 22-12-2008 11:54 PM

collecting multiple bounding box entries
 
Hey,

A few weeks back I got some help about running commands on entry to bounding box's..

Here was the final code I had from here...

{

int $objectIsInside;// on/off switch
int $time = `currentTime -query`;// get current frame
vector $cylBBox[] = `xform -q -ws -boundingBox pCylinder1`;// cylinder's BBox
vector $cubeBBox[] = `xform -q -ws -boundingBox pCube1`;// cube'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 true set to yes
$objectIsInside = yes;//check if object is in BBox
}
} else {
if ($objectIsInside) //if true set to no
print ($time);//print current frame
$objectIsInside = no;//check if object is in BBox
}

}

What I would like to be able to do to add to this, is to be able to select a group of objects, like the cylinder thats used in the above code, and select a second group of objects, like cubes from the above code, and have the time recorded each time one of the cylinders enters or exits the bounding box of the cubes.

I am getting really confused about the way in which to do this, any help would be very much appreciated.

Thanks, Chris


All times are GMT. The time now is 06:58 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Simply Maya 2018