don't fail if spheres have identical center, use arbitrary separating normal (1,0,0)

Thanks Sean Tasker for reporting!
http://www.bulletphysics.com/Bullet/phpBB3/viewtopic.php?f=9&t=1681
This commit is contained in:
ejcoumans
2007-11-21 04:17:00 +00:00
parent 58014b9848
commit 5c1609fb23

View File

@@ -66,7 +66,12 @@ void btSphereSphereCollisionAlgorithm::processCollision (btCollisionObject* col0
///distance (negative means penetration)
btScalar dist = len - (radius0+radius1);
btVector3 normalOnSurfaceB = diff / len;
btVector3 normalOnSurfaceB(1,0,0);
if (len > SIMD_EPSILON)
{
normalOnSurfaceB = diff / len;
}
///point on A (worldspace)
btVector3 pos0 = col0->getWorldTransform().getOrigin() - radius0 * normalOnSurfaceB;
///point on B (worldspace)