[ODE] RE: Terrain<->Box collision without tri-collider
Fabian Herb
commander at herb-clan.de
Tue Jan 28 10:57:01 2003
Hello again,
>Steps involved:
>1. do a simple bounding sphere test to determine potentially 'hit'
>triangles near your object
>2. check each potentially 'hit' triangle using Tomas Akenine-Möller
>tribox test
>3. if a tribox test returns true then use ODE box-plane collide
>method (dCollideBP) to generate the contact geom
>4. generate contacts as usual (ie. using ODE's method dJointCreateContact)
It's probably a good idea to have (multiple) early-exit tests. My own
code creates almost ready-to-use contact normals and penetration
depths for every triangle it checks, although all, except perhaps one
or two, don't collide at all.
But checking every triangle in this manner has some negative aspects:
- All the collision normals point away direction from the triangle,
even if you have edge-edge contacts or a box face colliding with a
terrain vertex.
- I don't know how fast this tri-box collider really is (I didn't
check out the docs yet), but checking every triangle for its own
means checking each terrain edge twice and each vertex between 4 and
8 times (depending on if you use alternating triangle direction in
the mesh).
Anyway, thanks for your contribution :-)
Fabian