mirror of
https://github.com/overte-org/overte.git
synced 2025-08-04 14:59:47 +02:00
Merge pull request #15730 from SamGondelman/assert
BUGZ-631: Don't normalize zero vector in flipNormalsMyAvatarVsBackfacingTriangles
This commit is contained in:
commit
34283097d2
1 changed files with 1 additions and 1 deletions
|
@ -35,7 +35,7 @@ static bool flipNormalsMyAvatarVsBackfacingTriangles(btManifoldPoint& cp,
|
||||||
const btVector3* v = triShape->m_vertices1;
|
const btVector3* v = triShape->m_vertices1;
|
||||||
btVector3 faceNormal = colObj1Wrap->getWorldTransform().getBasis() * btCross(v[1] - v[0], v[2] - v[0]);
|
btVector3 faceNormal = colObj1Wrap->getWorldTransform().getBasis() * btCross(v[1] - v[0], v[2] - v[0]);
|
||||||
float nDotF = btDot(faceNormal, cp.m_normalWorldOnB);
|
float nDotF = btDot(faceNormal, cp.m_normalWorldOnB);
|
||||||
if (nDotF <= 0.0f) {
|
if (nDotF <= 0.0f && faceNormal.length2() > EPSILON) {
|
||||||
faceNormal.normalize();
|
faceNormal.normalize();
|
||||||
// flip the contact normal to be aligned with the face normal
|
// flip the contact normal to be aligned with the face normal
|
||||||
cp.m_normalWorldOnB += -2.0f * nDotF * faceNormal;
|
cp.m_normalWorldOnB += -2.0f * nDotF * faceNormal;
|
||||||
|
|
Loading…
Reference in a new issue