Merge pull request #1119 from AndrewMeadows/minor-cleanup-contraints

fix typo in btHingeConstraint method name
This commit is contained in:
erwincoumans
2017-05-12 23:35:06 +00:00
committed by GitHub
5 changed files with 17 additions and 34 deletions

View File

@@ -516,7 +516,7 @@ int b3Generic6DofConstraint::get_limit_motor_info2(
b3ConstraintInfo2 *info, int row, b3Vector3& ax1, int rotational,int rotAllowed) b3ConstraintInfo2 *info, int row, b3Vector3& ax1, int rotational,int rotAllowed)
{ {
int srow = row * info->rowskip; int srow = row * info->rowskip;
int powered = limot->m_enableMotor; bool powered = limot->m_enableMotor;
int limit = limot->m_currentLimit; int limit = limot->m_currentLimit;
if (powered || limit) if (powered || limit)
{ // if the joint is powered, or has joint limits, add in the extra row { // if the joint is powered, or has joint limits, add in the extra row
@@ -584,7 +584,7 @@ int b3Generic6DofConstraint::get_limit_motor_info2(
} }
// if we're limited low and high simultaneously, the joint motor is // if we're limited low and high simultaneously, the joint motor is
// ineffective // ineffective
if (limit && (limot->m_loLimit == limot->m_hiLimit)) powered = 0; if (limit && (limot->m_loLimit == limot->m_hiLimit)) powered = false;
info->m_constraintError[srow] = b3Scalar(0.f); info->m_constraintError[srow] = b3Scalar(0.f);
if (powered) if (powered)
{ {

View File

@@ -776,7 +776,7 @@ int btGeneric6DofConstraint::get_limit_motor_info2(
btConstraintInfo2 *info, int row, btVector3& ax1, int rotational,int rotAllowed) btConstraintInfo2 *info, int row, btVector3& ax1, int rotational,int rotAllowed)
{ {
int srow = row * info->rowskip; int srow = row * info->rowskip;
int powered = limot->m_enableMotor; bool powered = limot->m_enableMotor;
int limit = limot->m_currentLimit; int limit = limot->m_currentLimit;
if (powered || limit) if (powered || limit)
{ // if the joint is powered, or has joint limits, add in the extra row { // if the joint is powered, or has joint limits, add in the extra row
@@ -840,7 +840,7 @@ int btGeneric6DofConstraint::get_limit_motor_info2(
} }
// if we're limited low and high simultaneously, the joint motor is // if we're limited low and high simultaneously, the joint motor is
// ineffective // ineffective
if (limit && (limot->m_loLimit == limot->m_hiLimit)) powered = 0; if (limit && (limot->m_loLimit == limot->m_hiLimit)) powered = false;
info->m_constraintError[srow] = btScalar(0.f); info->m_constraintError[srow] = btScalar(0.f);
if (powered) if (powered)
{ {

View File

@@ -556,12 +556,8 @@ void btHingeConstraint::getInfo2Internal(btConstraintInfo2* info, const btTransf
} }
// if the hinge has joint limits or motor, add in the extra row // if the hinge has joint limits or motor, add in the extra row
int powered = 0; bool powered = getEnableAngularMotor();
if(getEnableAngularMotor()) if(limit || powered)
{
powered = 1;
}
if(limit || powered)
{ {
nrow++; nrow++;
srow = nrow * info->rowskip; srow = nrow * info->rowskip;
@@ -577,7 +573,7 @@ void btHingeConstraint::getInfo2Internal(btConstraintInfo2* info, const btTransf
btScalar histop = getUpperLimit(); btScalar histop = getUpperLimit();
if(limit && (lostop == histop)) if(limit && (lostop == histop))
{ // the joint motor is ineffective { // the joint motor is ineffective
powered = 0; powered = false;
} }
info->m_constraintError[srow] = btScalar(0.0f); info->m_constraintError[srow] = btScalar(0.0f);
btScalar currERP = (m_flags & BT_HINGE_FLAGS_ERP_STOP) ? m_stopERP : normalErp; btScalar currERP = (m_flags & BT_HINGE_FLAGS_ERP_STOP) ? m_stopERP : normalErp;
@@ -951,12 +947,8 @@ void btHingeConstraint::getInfo2InternalUsingFrameOffset(btConstraintInfo2* info
} }
// if the hinge has joint limits or motor, add in the extra row // if the hinge has joint limits or motor, add in the extra row
int powered = 0; bool powered = getEnableAngularMotor();
if(getEnableAngularMotor()) if(limit || powered)
{
powered = 1;
}
if(limit || powered)
{ {
nrow++; nrow++;
srow = nrow * info->rowskip; srow = nrow * info->rowskip;
@@ -972,7 +964,7 @@ void btHingeConstraint::getInfo2InternalUsingFrameOffset(btConstraintInfo2* info
btScalar histop = getUpperLimit(); btScalar histop = getUpperLimit();
if(limit && (lostop == histop)) if(limit && (lostop == histop))
{ // the joint motor is ineffective { // the joint motor is ineffective
powered = 0; powered = false;
} }
info->m_constraintError[srow] = btScalar(0.0f); info->m_constraintError[srow] = btScalar(0.0f);
btScalar currERP = (m_flags & BT_HINGE_FLAGS_ERP_STOP) ? m_stopERP : normalErp; btScalar currERP = (m_flags & BT_HINGE_FLAGS_ERP_STOP) ? m_stopERP : normalErp;

View File

@@ -314,7 +314,7 @@ public:
{ {
return m_enableAngularMotor; return m_enableAngularMotor;
} }
inline btScalar getMotorTargetVelosity() inline btScalar getMotorTargetVelocity()
{ {
return m_motorTargetVelocity; return m_motorTargetVelocity;
} }

View File

@@ -364,7 +364,6 @@ void btSliderConstraint::getInfo2NonVirtual(btConstraintInfo2* info, const btTra
int srow; int srow;
btScalar limit_err; btScalar limit_err;
int limit; int limit;
int powered;
// next two rows. // next two rows.
// we want: velA + wA x relA == velB + wB x relB ... but this would // we want: velA + wA x relA == velB + wB x relB ... but this would
@@ -470,13 +469,9 @@ void btSliderConstraint::getInfo2NonVirtual(btConstraintInfo2* info, const btTra
limit_err = getLinDepth() * signFact; limit_err = getLinDepth() * signFact;
limit = (limit_err > btScalar(0.0)) ? 2 : 1; limit = (limit_err > btScalar(0.0)) ? 2 : 1;
} }
powered = 0; bool powered = getPoweredLinMotor();
if(getPoweredLinMotor())
{
powered = 1;
}
// if the slider has joint limits or motor, add in the extra row // if the slider has joint limits or motor, add in the extra row
if (limit || powered) if (limit || powered)
{ {
nrow++; nrow++;
srow = nrow * info->rowskip; srow = nrow * info->rowskip;
@@ -524,7 +519,7 @@ void btSliderConstraint::getInfo2NonVirtual(btConstraintInfo2* info, const btTra
btScalar histop = getUpperLinLimit(); btScalar histop = getUpperLinLimit();
if(limit && (lostop == histop)) if(limit && (lostop == histop))
{ // the joint motor is ineffective { // the joint motor is ineffective
powered = 0; powered = false;
} }
info->m_constraintError[srow] = 0.; info->m_constraintError[srow] = 0.;
info->m_lowerLimit[srow] = 0.; info->m_lowerLimit[srow] = 0.;
@@ -609,12 +604,8 @@ void btSliderConstraint::getInfo2NonVirtual(btConstraintInfo2* info, const btTra
limit = (limit_err > btScalar(0.0)) ? 1 : 2; limit = (limit_err > btScalar(0.0)) ? 1 : 2;
} }
// if the slider has joint limits, add in the extra row // if the slider has joint limits, add in the extra row
powered = 0; powered = getPoweredAngMotor();
if(getPoweredAngMotor()) if(limit || powered)
{
powered = 1;
}
if(limit || powered)
{ {
nrow++; nrow++;
srow = nrow * info->rowskip; srow = nrow * info->rowskip;
@@ -630,7 +621,7 @@ void btSliderConstraint::getInfo2NonVirtual(btConstraintInfo2* info, const btTra
btScalar histop = getUpperAngLimit(); btScalar histop = getUpperAngLimit();
if(limit && (lostop == histop)) if(limit && (lostop == histop))
{ // the joint motor is ineffective { // the joint motor is ineffective
powered = 0; powered = false;
} }
currERP = (m_flags & BT_SLIDER_FLAGS_ERP_LIMANG) ? m_softnessLimAng : info->erp; currERP = (m_flags & BT_SLIDER_FLAGS_ERP_LIMANG) ? m_softnessLimAng : info->erp;
if(powered) if(powered)