add btVector3::safeNorm to avoid/workaround certain clang/g++ issue or returning -INF

when taking sqrtf(0.0000000000000000000000000000000000000108333558)
This commit is contained in:
Erwin Coumans
2016-09-25 23:13:23 -07:00
parent c05784ea88
commit 6563c9c821
3 changed files with 16 additions and 6 deletions

View File

@@ -133,7 +133,7 @@ void btMultiBodySliderConstraint::createConstraintRows(btMultiBodyConstraintArra
for (int i = 0; i < 3; ++i)
{
constraintAxis[0] = frameAworld.getColumn(i).cross(jointAxis);
if (constraintAxis[0].norm() > EPSILON)
if (constraintAxis[0].safeNorm() > EPSILON)
{
constraintAxis[0] = constraintAxis[0].normalized();
constraintAxis[1] = jointAxis.cross(constraintAxis[0]);