Collision Traverser question [SOLVED]

Is it more efficient to only run a single collision traverser in a game, or does it not matter if you have multiple, so long as the total number of collisions is the same?

What I’m asking, basically, is if you get better performance with one traverser handling all collision checked, or if breaking the collision checking up along multiple traversers gives the same performance.

There is a theoretical advantage to sharing one CollisionTraverser for all your collisions, because then it may be able to handle everything in a single pass. Whether you actually meet this goal depends on the number of colliders you have, and whether they are all colliding with the same objects or not.

David

Let me explain my traverser situation then, because I’m thinking that I wouldn’t get any advantage to a single traverser for everything, but I might get an advantage for compiling some of my traversers together.

So, this is a combat racing game. I’m hoping to have 12-16 racers on the track at once.

Each racer has it’s own traversers for the following tasks:
bumpTrav: checks collisions against the racer’s bumper ( 3 collision spheres that mostly cover the racer ), other racer’s bumpers, and the walls octree.
gRayTrav: checks collisions between the two rays shooting down from above the racer and the ground octree.
Each gun on each racer has it’s own traverser to check for collisions between it’s bullets (1 collision sphere) and the cycles’ shield octrees, the walls octree, and the ground octree.

I’m filtering the collisions with bitmasks, also.

What do you guys think? Should I combine some of these traversers together?

Well, the ultimate answer is to try it and see. But it does sound like you will have a win with a single traverser. A traverser can handle up to 32 “from” objects in a single pass (beyond that, and it will automatically split it up into multiple passes).

As long as the traverser must visit the same nodes, even if it is not actually testing against the same objects, there is a win for combining multiple passes into a single pass. Since it sounds like all of your “into” objects are in the same part of the scene graph, it’s probably advantageous to test them all in the same pass with a single traverser.

That said, the advantage of having just one pass is not that big. Depending on your code structure, it might be worth it to use multiple traversers anyway, if that makes your code cleaner. But if you can easily share a single traverser, it’s probably a good idea to do so.

David

That was a very clear, in depth, and helpful answer David. Thanks again.