[ODE] dSpaceCollide2 - quadspace vs hashspace bug

Christian Muschick christian.muschick at gmail.com
Fri Nov 9 13:36:29 MST 2007


(full quote below because the original post was 3 years ago)

The exact problem Hannes describes below had me occupied for today until
I realized the bug is not in my own code. I am mildly surprised that the
topic didn't receive more attention when it was addressed, is colliding
a hash space against a quadtree space such an uncommon thing to do?

In my opinion it would be the best thing to assert if unsupported / not
yet implemented collision routines are called. The same problem applies
to colliding quadtree against quadtree spaces. Trying to enumerate
quadtree geoms via dSpaceGetGeom asserts, as expected for an unsupported

Could somebody explain what the problem is in iterating over quadtree
geoms, anyway? Is it a real problem at all, or is there simply nobody
who needs this feature?


Hannes Norda wrote:
> 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
> _______________________________________________
> ODE mailing list
> ODE at q12.org
> http://q12.org/mailman/listinfo/ode

More information about the ODE mailing list