safe normalize on degenerate triangles

This commit is contained in:
Erwin Coumans
2018-07-30 12:21:02 +02:00
parent 5dd7a62397
commit e75178181d

View File

@@ -158,7 +158,7 @@ void CollisionShape2TriangleMesh(btCollisionShape* collisionShape, const btTrans
btVector3 pos1 =parentTransform*hull->getVertexPointer()[index1]; btVector3 pos1 =parentTransform*hull->getVertexPointer()[index1];
btVector3 pos2 =parentTransform*hull->getVertexPointer()[index2]; btVector3 pos2 =parentTransform*hull->getVertexPointer()[index2];
triNormal = (pos1-pos0).cross(pos2-pos0); triNormal = (pos1-pos0).cross(pos2-pos0);
triNormal.normalize(); triNormal.safeNormalize();
for (int v=0;v<3;v++) for (int v=0;v<3;v++)
{ {