Maya 2020 fundamentals - modelling the real world
Get halfway through a model and find it's an unworkable mess? Can't add edge loops where you need them? Can't subdivide a mesh properly? If any of this sounds familiar check this course out.
# 1 22-12-2008 , 11:54 PM
bendingiscool's Avatar
Subscriber
Join Date: Jul 2006
Location: London
Posts: 567

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

Posting Rules Forum Rules
You may not post new threads | You may not post replies | You may not post attachments | You may not edit your posts | BB code is On | Smilies are On | [IMG] code is On | HTML code is Off

Similar Threads