Questions about ODE collision concepts


#1

Hey there, very new to Panda3D and ODE here. I’ve been looking around the forums, page, and ODE wiki, and I still can’t determine if there’s actually a way to go about doing what I’m trying to accomplish.

I’m making 2 different ODE objects with bodies and masses, and a plane for a floor. I’ll call them o1, o2, and floor.

I currently do the following:

  • Create an OdeWorld, surface, etc.
  • Create an OdeSpace and set it’s auto collide world as my OdeWorld.
  • Create 2 OdeBody’s in my world, give them OdeMasses.
  • Create 2 OdeSphereGeom’s in my OdeSpace, and assign the bodies to each respective sphere.
  • Create an OdePlanGeom as my floor.
  • Run AutoCollide in the simulation task.

The result:

o1 and o2 can bounce around on the floor, and bounce off of / interact with both the floor and each other.

What I’m trying to figure out how to do:

  • o1 and o2 to be able to collide with and be stopped by the floor. (check)
  • o1 and o2 to be able to pass through each other, but also throw an event when they intersect.

I also want to be able to scale this up to 50 objects or more.

Is this sort of a thing possible by using 2 different "OdeSpace"s or something?

I thought about setting different collide bits for the objects, but my interpretation of that feature was that setting the objects with different collide bits would prevent me from knowing when they would have collided, and even if that’s not the case, I may be limiting myself to around 30 objects doing so.

So basically, I’m uncertain about the right way to go about this. Any help is greatly appreciated!


#2

Correct, setting the collide bits will prevent any kind of events being generated. You have a few options:

  • Check out this thread, you may be able to either use it or extract the part that you need: [url]ODE Middleware]
  • Set collide bits to prevent collision events, then manually call OdeUtil.collide(geom1, geom2) between things that you want to test for collision, but don’t want to react.
  • A hybrid collision system: Set collide bits to prevent collision events, then use the Panda collision system for trigger-like collision detection.

#3

Ah, thanks so much for the input!

Using a hybrid system like you suggested is working quite well so far.