Some optimizations for btMultiBodyJointMotor (skip constraint generation if maxImpulse/maxForce = 0) and
skip constraint row generation if joint limit is not violated.
This commit is contained in:
@@ -110,7 +110,13 @@ void btMultiBodyJointLimitConstraint::createConstraintRows(btMultiBodyConstraint
|
|||||||
|
|
||||||
for (int row=0;row<getNumRows();row++)
|
for (int row=0;row<getNumRows();row++)
|
||||||
{
|
{
|
||||||
|
btScalar penetration = getPosition(row);
|
||||||
|
|
||||||
|
//todo: consider adding some safety threshold here
|
||||||
|
if (penetration>0)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
btScalar direction = row? -1 : 1;
|
btScalar direction = row? -1 : 1;
|
||||||
|
|
||||||
btMultiBodySolverConstraint& constraintRow = constraintRows.expandNonInitializing();
|
btMultiBodySolverConstraint& constraintRow = constraintRows.expandNonInitializing();
|
||||||
@@ -158,7 +164,7 @@ void btMultiBodyJointLimitConstraint::createConstraintRows(btMultiBodyConstraint
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
btScalar penetration = getPosition(row);
|
|
||||||
btScalar positionalError = 0.f;
|
btScalar positionalError = 0.f;
|
||||||
btScalar velocityError = - rel_vel;// * damping;
|
btScalar velocityError = - rel_vel;// * damping;
|
||||||
btScalar erp = infoGlobal.m_erp2;
|
btScalar erp = infoGlobal.m_erp2;
|
||||||
|
|||||||
@@ -117,6 +117,9 @@ void btMultiBodyJointMotor::createConstraintRows(btMultiBodyConstraintArray& con
|
|||||||
if (m_numDofsFinalized != m_jacSizeBoth)
|
if (m_numDofsFinalized != m_jacSizeBoth)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (m_maxAppliedImpulse==0.f)
|
||||||
|
return;
|
||||||
|
|
||||||
const btScalar posError = 0;
|
const btScalar posError = 0;
|
||||||
const btVector3 dummy(0, 0, 0);
|
const btVector3 dummy(0, 0, 0);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user