fix degerenate case in btHingeConstraint, see Issue 2031

https://github.com/bulletphysics/bullet3/issues/2031
This commit is contained in:
erwincoumans
2018-12-22 11:19:15 -08:00
parent 875a5f6b0e
commit 63ac2182ae

View File

@@ -764,6 +764,12 @@ void btHingeConstraint::getInfo2InternalUsingFrameOffset(btConstraintInfo2* info
btVector3 ax1A = trA.getBasis().getColumn(2);
btVector3 ax1B = trB.getBasis().getColumn(2);
btVector3 ax1 = ax1A * factA + ax1B * factB;
if (ax1.length2()<SIMD_EPSILON)
{
factA=0.f;
factB=1.f;
ax1 = ax1A * factA + ax1B * factB;
}
ax1.normalize();
// fill first 3 rows
// we want: velA + wA x relA == velB + wB x relB