Skip to content
This repository was archived by the owner on Jan 5, 2024. It is now read-only.

Commit 3fbebc3

Browse files
committed
Pull out impulseforce magnitude int a variable since it's used twice and it makes debugging easier in future
1 parent 09ae7e0 commit 3fbebc3

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Entities/Attachable.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,11 +216,12 @@ namespace RTE {
216216
}
217217
totalImpulseForce *= jointStiffnessValueToUse;
218218

219-
if (gibImpulseLimitValueToUse > 0 && totalImpulseForce.GetMagnitude() > gibImpulseLimitValueToUse) {
219+
float totalImpulseForceMagnitude = totalImpulseForce.GetMagnitude();
220+
if (gibImpulseLimitValueToUse > 0 && totalImpulseForceMagnitude > gibImpulseLimitValueToUse) {
220221
jointImpulses += totalImpulseForce.SetMagnitude(gibImpulseLimitValueToUse);
221222
GibThis();
222223
return false;
223-
} else if (jointStrengthValueToUse > 0 && totalImpulseForce.GetMagnitude() > jointStrengthValueToUse) {
224+
} else if (jointStrengthValueToUse > 0 && totalImpulseForceMagnitude > jointStrengthValueToUse) {
224225
jointImpulses += totalImpulseForce.SetMagnitude(jointStrengthValueToUse);
225226
m_Parent->RemoveAttachable(this, true, true);
226227
return false;

0 commit comments

Comments
 (0)