Checking for ODE collisions

Is there a way to know when two ODE geometries collide (using integrated Panda3D ODE)? I see that there will be a callback function in 1.6.0, but I was wondering if there was a way to do it without waiting for 1.6.0 and/or installing PyODE.

Thanks!

Not as far as I can tell, I’ve been looking for a way to do that but I haven’t touched my ODE tests in a while. A worthwhile avenue of investigation might be OdeSpace.getContactData/OdeSpace.getContactId. The auto collide callback function in the C++ code mentions that it stores 64 contact points for debugging purposes.

I haven’t been able to figure out what the return values of those functions are supposed to be. It might be a good idea to do a test script with just an OdeSpace to test collisions and not an OdeWorld for doing dynamics, although I’m not sure if the autoCollide system will let you do that.

Okay, I was able to install a recent 1.6.0 build from this handy link on launchpad: http://bin.pro-rsoft.com/panda3d_1.6.0-ubuntuhardy_i386.deb

But I still don’t know how to use the near callback, and obviously there’s no documentation for it yet. Any ideas?

Uh, that build is not official and very buggy. (You can’t actually say its 1.6.0 yet.) I doubt it implements the collide function well yet.

You use it just like you would in PyODE:

def near_callback(args, geom1, geom2):
  print "Potential collision!"

yourSpace.collide(None, near_callback)

The first argument to collide() is also the first argument that is passed to your near_callback function.

Do note that the near_callback might also get called when there’s not really a collision, and you should use OdeUtil.collide() which returns an OdeContactCollection of OdeContact objects (see API) for the collision. However, the implementation for OdeUtil.collide isn’t ready yet, I think.

Yes, I knew it was a development snapshot type thing. I just wanted to know how things will pan out for 1.6. I was especially curious about the PyODE function ode.collide, but I see now that it will be in OdeUtils.

Thanks for the clarification! I will now wait patiently for the official release. :smiley: