Cache angular impulse to use in force limits

This commit is contained in:
Dmitry Tsarevich 2023-10-10 21:00:38 +03:00
parent c0b614ec1c
commit 2e4e37be8a
No known key found for this signature in database
GPG Key ID: 3852365567163251
1 changed files with 2 additions and 1 deletions

View File

@ -199,7 +199,8 @@ void JoltPhysicsConstraint::SetAngularMotor( float rotSpeed, float maxAngularImp
pConstraint->SetTargetAngularVelocity( rotSpeed );
JPH::MotorSettings &motorSettings = pConstraint->GetMotorSettings();
motorSettings.SetForceLimits( -fabsf( maxAngularImpulse ), fabsf( maxAngularImpulse ) );
const float angularImpulse = fabsf( maxAngularImpulse );
motorSettings.SetForceLimits( -angularImpulse, angularImpulse );
break;
}