Resolved - I was setting visibility keyframes, and in some circumstances they were being set before the bb check, and I was using boundingBox instead of boundingBoxInvisible. I didn't know what a bb of an invisible object looked like, but after two days of watching them scroll by I'll never forget again.
Thanks again all, P On Jan 21, 11:07 am, pjrich <[email protected]> wrote: > I spoke too soon, it does it with xform as well. I'm trying to narrow > down the cases where it happens, if I learn anything more I'll post > it. > > P > > On Jan 21, 10:42 am, pjrich <[email protected]> wrote: > > > > > Yep, a plain xform doesn't have the same trouble. At the moment I'm > > doing a lot of sub-optimal repeated querys, so it's probably an > > unlikely use case, but it's working. I probably just overheated the > > wrapper. Thanks! > > > P > > > On Jan 20, 11:30 pm, Chad Dombrova <[email protected]> wrote: > > > > i just double-checked the pymel code. it's a straight wrapper of the > > > maya.cmds xform command, so i'm not sure if going pure maya.cmds will > > > help, but let me know if you find a difference: > > > > def getBoundingBox(self, invisible=False, space='object'): > > > """xform -boundingBox and xform -boundingBoxInvisible > > > > :rtype: `BoundingBox` > > > > """ > > > kwargs = {'query' : True } > > > if invisible: > > > kwargs['boundingBoxInvisible'] = True > > > else: > > > kwargs['boundingBox'] = True > > > if space=='object': > > > kwargs['objectSpace'] = True > > > elif space=='world': > > > kwargs['worldSpace'] = True > > > else: > > > raise ValueError('unknown space %r' % space) > > > > res = cmds.xform( self, **kwargs ) > > > #return ( datatypes.Vector(res[:3]), datatypes.Vector(res[3:]) ) > > > return datatypes.BoundingBox( res[:3], res[3:] ) > > > > On Jan 20, 2010, at 8:01 PM, pjrich wrote: > > > > > Thanks, I'll try both -- any ideas about which is likely to be faster? > > > > > P > > > > > On Jan 20, 9:43 pm, "Subbu.Add" <[email protected]> wrote: > > > >> Hi Peter, > > > > >> I have utilized this feature directly in Maya Python. > > > >> and I am able to find out whether two objects colliding or not. > > > >> Except for polyCubes, It is working for all other objects and > > > >> complicated > > > >> shapes also > > > >> Some times it is working for polyCubes also. > > > > >> we have to use: > > > > >> xform (firstObj, q=1, ws=1, bb=1) -------> It yields 6 digits > > > >> --------> > > > >> [f_minX, f_minY, f_minZ, f_maxX, f_maxY, f_maxZ] # bb yields > > > >> bounding box information > > > >> xform (secondObj, q=1, ws=1, bb=1) -------> It yields 6 digits > > > >> --------> > > > >> [s_minX, s_minY, s_minZ, s_maxX, s_maxY, s_maxZ] > > > > >> collideCheck =[] > > > > >> for fx in range(f_minX, f_maxX): > > > >> if (fx> s_minX) and (fx<s_maxX): > > > >> collideCheck.append(True) > > > >> break > > > > >> --do-- for yRange > > > > >> --do-- for zRange > > > > >> if collideCheck == [True, True, True] > > > >> print 'Objects are colliding' > > > >> else: > > > >> print 'Not colliding' > > > > >> Try this.. > > > > >> Subbu > > > > >> On Thu, Jan 21, 2010 at 5:50 AM, Chad Dombrova <[email protected]> > > > >> wrote: > > > >>> we've fixed a few bugs with api wrappers in 1.0. you might want to > > > >>> check > > > >>> out the current rc1 release on our downloads page. > > > > >>> -chad > > > > >>> On Wed, Jan 20, 2010 at 3:23 PM, pjrich <[email protected]> > > > >>> wrote: > > > > >>>> I'm implementing a collision detection scheme in Maya 2009 with PyMEL > > > >>>> 0.9.2 which makes extensive use of getBoundingBox(). I'm running into > > > >>>> some weirdness -- occasionally instead of returning a min and a max, > > > >>>> getBoundingBox() returns two points which are both the average of the > > > >>>> real min and max. > > > > >>>> So instead of: > > > >>>> [(1, 1, 1), (2, 2, 2)] > > > >>>> I'll get: > > > >>>> [(1.5, 1.5, 1.5), (1.5, 1.5, 1.5)] > > > > >>>> Sometimes this will cause getBoundingBox().intersects() to > > > >>>> erroneously > > > >>>> return False. When this happens and an intersection is missed, if I > > > >>>> run a manual check, the bounding box comes back properly. > > > > >>>> This doesn't happen consistently, only after quite a few iterations, > > > >>>> and only on objects I've just created. I'm only working with > > > >>>> polyCubes > > > >>>> at the moment. > > > > >>>> Has anyone else ever run into this? I don't see it in the issues > > > >>>> list, > > > >>>> did I find a bug? > > > > >>>> - Peter > > > > >>>> -- > > > >>>>http://groups.google.com/group/python_inside_maya > > > > >>> -- > > > >>>http://groups.google.com/group/python_inside_maya > > > > -- > > > >http://groups.google.com/group/python_inside_maya
-- http://groups.google.com/group/python_inside_maya
