[SOLVED] Custom collision handling in ODE

Hi all,

I want to use ODE for my game’s physics. However, I also need Area Triggers and I haven’t been able to figure out any more flexible way to deal with that that writing my own collision handling function. I got it to work, but I have one problem. I can’t find out how to get the data required for OdeSurfaceParameters to put into OdeContact.setSurface().

I’ve checked the Panda’s source code and it seems like auto_callback uses the OdeWorld’s get_surface(surf1, surf2) function to dig everything out, but I haven’t been able to get to that function from Python.

So my question is how can I get to that data (friction, bounce etc.) from Python? Also, if you guys have a better suggestion for Area Triggers than writing own collision callback I’m open to suggestions :slight_smile:.

Anyway, here’s where I am now. I’m working with the ODE collisions example from the manual:

Any suggestions on the collision function are also welcome, if you see I screwed something up there.

Thanks in advance,


With the auto-callback system, you need to preload the surface data into a table. This page explains it:
panda3d.org/manual/index.php/C … n_with_ODE

I know how to use autoCollide, and I know about the surface table.

I just don’t know how to get that information out of that table for my own collision callback.

The thing is that the only way I see for making area triggers, and maybe some other things, with autoCollide is to call autoCollide a few times during a simulation step. It seems like I would need to create the area triggers, call autoCollide, destroy the triggers, clear the collision joint group, to make sure that the area trigger collisions only cause collision event to be sent, but do not participate in the rest of the process (i.e. that things won’t bounce off of them and can penetrate them), and than call autoCollide again to make the actual collisions (this time without the Area Triggers existing in the ode space).

Now, I think, and correct me if I’m wrong, that calling autoCollide a few times and creating and destroying the Area Triggers’ (and Rays’) OdeGeoms during every simulation step is a waste. I though of a more efficient (at least I think it’s more efficient, again, correct me if I’m wrong) way of doing that, which is as follows:

  1. Make my own collision callback handling function.
  2. Put Area Triggers, Rays, perhaps Kinematic Objects (like character controller) etc. into different lists.
  3. Use the custom collision callback function to check every object against those lists to find out how to handle it (as a trigger, as a kinematic objects etc.).

Now, will that idea be more or perhaps less efficient than running autoCollide more than once during every single step, and still running through a few lists to recreate and destroy stuff?

And if it will be more efficient, how can I get to that surface data, because I see no way of doing that from Python…?

Also, maybe there is some other way, but I haven’t found any way of setting OdeGeoms to “area triggerish” behavior, and even though collision events do the job of notifying me about a collision, I see no way of preventing ODE from preventing penetration on selected objects.



Ok, it seems like sometimes I just try too hard xD. For some reason I though I just HAVE TO use the OdeWorld’s SurfaceTable even with my own Collision handler, while I do not… I’ve made my own list for surface data and it all works like a charm. I have to make my thinking more flexible in such cases xD. Thanks :slight_smile: