|
@@ -272,8 +272,16 @@ void SwingTwistConstraint::SetupVelocityConstraint(float inDeltaTime)
|
|
|
|
|
|
case EMotorState::Position:
|
|
|
// Use motor to drive rotation error to zero
|
|
|
- for (int i = 1; i < 3; ++i)
|
|
|
- mMotorConstraintPart[i].CalculateConstraintPropertiesWithSettings(inDeltaTime, *mBody1, *mBody2, mWorldSpaceMotorAxis[i], 0.0f, rotation_error[i], mSwingMotorSettings.mSpringSettings);
|
|
|
+ if (mSwingMotorSettings.mSpringSettings.HasStiffness())
|
|
|
+ {
|
|
|
+ for (int i = 1; i < 3; ++i)
|
|
|
+ mMotorConstraintPart[i].CalculateConstraintPropertiesWithSettings(inDeltaTime, *mBody1, *mBody2, mWorldSpaceMotorAxis[i], 0.0f, rotation_error[i], mSwingMotorSettings.mSpringSettings);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ for (int i = 1; i < 3; ++i)
|
|
|
+ mMotorConstraintPart[i].Deactivate();
|
|
|
+ }
|
|
|
break;
|
|
|
}
|
|
|
|
|
@@ -300,7 +308,10 @@ void SwingTwistConstraint::SetupVelocityConstraint(float inDeltaTime)
|
|
|
|
|
|
case EMotorState::Position:
|
|
|
// Use motor to drive rotation error to zero
|
|
|
- mMotorConstraintPart[0].CalculateConstraintPropertiesWithSettings(inDeltaTime, *mBody1, *mBody2, mWorldSpaceMotorAxis[0], 0.0f, rotation_error[0], mTwistMotorSettings.mSpringSettings);
|
|
|
+ if (mTwistMotorSettings.mSpringSettings.HasStiffness())
|
|
|
+ mMotorConstraintPart[0].CalculateConstraintPropertiesWithSettings(inDeltaTime, *mBody1, *mBody2, mWorldSpaceMotorAxis[0], 0.0f, rotation_error[0], mTwistMotorSettings.mSpringSettings);
|
|
|
+ else
|
|
|
+ mMotorConstraintPart[0].Deactivate();
|
|
|
break;
|
|
|
}
|
|
|
}
|