[ODE] dSpaceCollide2 - quadspace vs hashspace bug

Hannes Norda hannes.norda at gmail.com
Fri Dec 10 15:43:01 MST 2004


Hi!

I noticed that when using dSpaceCollide2 to collide a hashspace with a
quadspace, and the hashspace contains more objects than the quadspace,
no collision occurs.

The root of the problem seems to be that the quadspace doesn't use the
variable dxGeom *first; in dxSpace. It is always NULL.

Look at this piece of code (in dSpaceCollide2, collision_space.cpp):
// iterate through the space that has the fewest geoms, calling
       // collide2 in the other space for each one.
       if (s1->count < s2->count) {
         for (dxGeom *g = s1->first; g; g=g->next) {
           s2->collide2 (data,g,callback);
         }
       }
       else {
         for (dxGeom *g = s2->first; g; g=g->next) {
           s1->collide2 (data,g,callback);
         }
       }

When (hashspace->count > quadspace->count) there will be no
collisions, since the for-loop is immediately ended.

Anyone else stumbled across this and solved it nicely?
Anyhow, I guess I will do some research and see if I can perhaps
modify void dxQuadTreeSpace::add(dxGeom* g)  and make it work. Not
very familiar with quadspace internal structure, so we'll see what
happens.... :)

Normally this isn't an issue for me, since I store my static world in
the quadspace and my dynamic objects in the hashspace, and I've always
had more static objects up until I made a small test application
yesterday. Was mildly confused when all of a sudden no collisions
occured..

/Hannes


More information about the ODE mailing list