[ODE] Collider_Trimesh_Sphere

Marco Grubert mgrubert at conitec.net
Mon Apr 25 20:03:10 MST 2005

Could someone familiar with the Trimesher-Sphere collider please explain the 
contact calculation ?
In particular, I think that the contact->depth value is wrong and the 
contact->normal calculation seems odd:

GetContactData() calculates the closest feature distance between a sphere 
and a triangle and also returns the triangle normal. Let's assume the sphere 
contains one of the triangle vertices and the sphere center is in the 
triangle plane, but the triangle center is not inside the triangle. In that 
case the calculated distance is _not_ the distance along the 
triangle/contact normal but instead the distance along a normalized vector 
from that vertex to the sphere center. As long as the triangle center can be 
projected onto the triangle itself the calculation is correct, but it seems 
to be off in the general case.

In dCollideSTL all contacts are merged by default. For this all normals are 
scaled by the contact depth, added together and then the following 
calculations are performed:
  // Remember to divide in square space.
  Contact->depth = dSqrt(dDOT(Contact->normal, Contact->normal) / 

Why is the division done in "square space" as opposed to dividing the 
magnitude (not squared!) by OutTriCount ?

  Marco Grubert 

More information about the ODE mailing list