[ODE] Trimesh-sphere collision detection debugging

Jean-Sebastien Guay jean-sebastien.guay at polymtl.ca
Sun Mar 12 21:08:06 MST 2006


Hello again,

I'm trying to debug my collision detection. I've wrapped ODE's physics
functionality in my application's object classes using spheres to start, and a
trimesh for the terrain, and I'm getting a collision right at the start of the
program when I know there shouldn't be.

I've tried a run in the debugger and the colliding objects are the terrain (a
trimesh) and the submarine (for now, a very small sphere (0.1 radius)). I've
checked the physics objects' positions (bodies and geoms) and they match the
graphical objects' positions, and there should be no collision at that point.

How do people go about debugging collision detection? I imagine the easiest
thing would be to replace the complex terrain by a simple plane, and then see
where it's going wrong. But is there a way to see if the polygon data I gave as
the trimesh is actually any good? Basically I sent it over the same way I give
it to DirectX's vertex and index buffers, which I think was the goal of the
dGeomTriMeshDataBuildSingle() function.

Just to be sure: if I call dGeomSetBody() with a valid dGeomID and dBodyID, that
means that if I call dBodySetPosition on the body, the geom moves with it,
right?

And also: ODE (or I guess it's OPCODE that does this part) doesn't just check
bounding boxes, does it? I would hope it uses bounding boxes to reject
collisions quickly, then does tri-tri intersection or something like that to
make sure there really is a collision.

Finally: I read somewhere in the docs (or the wiki) that the best way to make an
immobile object was to not have a body associated to it. Is this the case?
Because as it is, my terrain has no body, only a geom (the trimesh), and I call
dGeomSetPosition() once on that to place it in the world.

I'm sure my problem lies in the way I initialize the data for the trimesh, or
the way I transform the objects afterwards. I suspect the physics object (in
ODE) is just not synchronized with the application object (in my game) in some
way, and I just have to find out where. But that's the part where I don't
really know how.

Sorry for being long-winded, I'm just trying to be specific so we don't have to
go back and forth too much. Thanks in advance,

J-S
--
______________________________________________________
Jean-Sebastien Guay     jean-sebastien.guay at polymtl.ca
                         http://whitestar02.webhop.org


More information about the ODE mailing list