add support in btHingeConstraint for m_angularOnly

This commit is contained in:
erwin.coumans
2010-07-21 22:50:10 +00:00
parent bfc439140b
commit 7a519da691

View File

@@ -358,10 +358,13 @@ void btHingeConstraint::getInfo2Internal(btConstraintInfo2* info, const btTransf
} }
#endif //#if 0 #endif //#if 0
// linear (all fixed) // linear (all fixed)
info->m_J1linearAxis[0] = 1;
info->m_J1linearAxis[skip + 1] = 1; if (!m_angularOnly)
info->m_J1linearAxis[2 * skip + 2] = 1; {
info->m_J1linearAxis[0] = 1;
info->m_J1linearAxis[skip + 1] = 1;
info->m_J1linearAxis[2 * skip + 2] = 1;
}
@@ -383,10 +386,13 @@ void btHingeConstraint::getInfo2Internal(btConstraintInfo2* info, const btTransf
} }
// linear RHS // linear RHS
btScalar k = info->fps * info->erp; btScalar k = info->fps * info->erp;
for(i = 0; i < 3; i++) if (!m_angularOnly)
{ {
info->m_constraintError[i * skip] = k * (pivotBInW[i] - pivotAInW[i]); for(i = 0; i < 3; i++)
} {
info->m_constraintError[i * skip] = k * (pivotBInW[i] - pivotAInW[i]);
}
}
// make rotations around X and Y equal // make rotations around X and Y equal
// the hinge axis should be the only unconstrained // the hinge axis should be the only unconstrained
// rotational axis, the angular velocity of the two bodies perpendicular to // rotational axis, the angular velocity of the two bodies perpendicular to