File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -210,7 +210,16 @@ Vector3 TriangleShape::computeSmoothLocalContactNormalForTriangle(const Vector3&
210
210
}
211
211
212
212
// We compute the contact normal as the barycentric interpolation of the three vertices normals
213
- return (u * mVerticesNormals [0 ] + v * mVerticesNormals [1 ] + w * mVerticesNormals [2 ]).getUnit ();
213
+ Vector3 interpolatedNormal = u * mVerticesNormals [0 ] + v * mVerticesNormals [1 ] + w * mVerticesNormals [2 ];
214
+
215
+ // If the interpolated normal is degenerated
216
+ if (interpolatedNormal.lengthSquare () < MACHINE_EPSILON) {
217
+
218
+ // Return the original normal
219
+ return mNormal ;
220
+ }
221
+
222
+ return interpolatedNormal.getUnit ();
214
223
}
215
224
216
225
// Update the AABB of a body using its collision shape
You can’t perform that action at this time.
0 commit comments