[ODE] High level collision detection strategy

Benny Kramek benny at kramekweb.com
Tue Mar 11 00:39:02 2003


I am working on a game that has a level made of boxes and cylinders and
a simple car made up of a rigid body for the chassis and 4 rigid bodies
for wheels. The car also has some collision geoms.
You can see a demo at http://die.sf.net

Right now I am using a brute force method for colliding the car with the
level, using ODE's spaces. I would like to optimize the collision
detection by doing lots of quick tests.

The level is completely static.

I am thinking of something like this algorithm.
- Precalculate the AABB of each geom in the level.
- Calculate the total AABB of the car every frame.
- Test the AABB of the car with the AABB of each level geom.
- If there is a collision, test each geom of the car with the actual
level geom and create contacts.

I will probably further optimize it by organizing the level geoms into a
grid structure or something similar, and then only test against level
geoms that are in the sector that the car is currently in.

My problem is that I don't know how to achieve this algorithm using
ODE's high level spaces. Is it possible?

My second question is about ray geoms. I need to simulate a light-speed
projectile. I experimented with using a ray and it works well. The
problem is that if I create a ray and test it against the level geoms
than it is possible to detect collision with multiple geoms. The bullet
"goes through walls". I could just find the shortest collision and use
that but I was wondering if there is a better way?

Thanks for the help,
Benny Kramek