[ODE] dCreateBox() inputs halfsizes?

Ruud van Gaal ruud at marketgraph.nl
Tue Dec 11 17:27:02 2001


Hi all,

I'm having some trouble with my collisions. One thing I need to know to be able 
to get through this is whether dCreateBox() accepts halfsizes, or the full 
length/width/height of the box?
I'm used to halfsizes, as separating axes methods use those.

Problem is that I'm creating a single ODE box for the body to add forces to. In 
this case the center of the box is also the center of mass, so any forces 
applied at certain points (suspension locations) give correct torques etc.
However, at collision time, I need the bounding box of the *geometry* instead, 
which is shifted with respect to it's dynamics counterpart. In other words, the 
space geomID box and the world bodyID box are related in size, but their 
centers don't match.
Take a Viper for example; it has its center of mass way back, but for 
collisions, its center of geometry (for dCollide()), is way in front of the 
bodyID's center.

I now shift the body before every collision test (obviously not very efficient) 
(back and forth). It seems to work in one direction when I let the car collide 
with a barrier, after a lot of searching (and a change in the ODE source which 
probably isn't right; I modified in geom.cpp the dCollideBP() function to use 
'dReal depth= -plane->p[3]...' (note the negation of the 'd' aka p[3] parameter 
of the plane).
Have to go to sleep now, but I'll try and see how the car collides at the other 
side of the track in 2 days, but before I can do that, I have to know whether 
the box lengths in dCreateBox() (thus box->side[i]) are half-lengths or 
full-lengths (couldn't quite tell from the docs, which talks about 'side 
lengths' which I can interpret either way). To avoid going mad. ;-)

Ofcourse, another question that rises is how to approach this problem more 
efficiently, i.e. how to get the geometry object to be offset from its dynamics 
(body) object. For every car, generally the center of mass will NOT be the 
center of geometry, that's why dCollide()'s center needs an offset.

Thanks for any ideas,
Ruud