[ODE] Collision CSG?

Pierre Terdiman p.terdiman at wanadoo.fr
Thu Mar 27 06:05:02 2003


> Here's an idea that might be interesting to add to the collision toolbox:
> primitive-mapped heightfields.  For example, you have a mesh of an arm
> that kinda halfway looks like a capped cylinder but not really.  So you
> take a capped cylinder, make a function to map it's surface to 2D (i.e.
> the long axis is x and degrees around it is y).  Then you could specify
> heights in terms of 0 = directly on the surface of the primitive, negative
> means that many units towards the center, and positive means that many
> units away from the center (all in body coordinates if I'm clear as mud).
> Nothing would happen until an object collided with the surface of the
> primitive, then the collision system would query the heightfield at that
> x,y coordinate (or you could just do it yourself).  This should be a lot
> faster than generic mesh collisions while still being able to define the
> exact same shape in many instances.

Hmm, I don't think it's going to work well, except in particular cases.

Let's try it with a sphere colliding against the capped cylinder, generating
a single contact point. Instead of using the capped cylinder's radius (used
to derive penetration depth for collision response), you sample the
heightfield for a fixed radius, and use that instead. Fine, it works. Until
you sample a local minima, surrounded by huge spikes in the field. Those
faces are going to penetrate the sphere quite badly without generating
contacts.

Unless I'm missing something, this approach generates only one contact
regardless of the heightfield. Can't work well in the generic case.

Now maybe I misunderstood the approach. Nonetheless it still looks a bit
vain, especially if the goal is to go "a lot faster than generic mesh
collisions". Indeed, as far as I can tell, you're speaking about
volume-vs-mesh queries, like sphere-vs-mesh (as opposed to mesh-vs-mesh,
unsupported in ODE). There's not much point in optimizing this, as it's
already pretty cheap.

But I may very well have missed your point.

Pierre