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

Commit afe7a9e

Browse files
committed
Unscrew screwup again
1 parent 9124cef commit afe7a9e

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

Entities/AtomGroup.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -748,7 +748,8 @@ namespace RTE {
748748
Vector legProgress;
749749
Vector forceVel;
750750
Vector returnPush;
751-
Vector trajectory = velocity * travelTime * c_PPM; // Trajectory length in pixels.
751+
Vector ownerVel = velocity;
752+
Vector trajectory = ownerVel * travelTime * c_PPM; // Trajectory length in pixels.
752753

753754
HitData hitData;
754755

@@ -793,7 +794,7 @@ namespace RTE {
793794
intPos[Y] = position.GetFloorIntY();
794795

795796
float prevTrajMag = trajectory.GetMagnitude();
796-
trajectory = velocity * timeLeft * c_PPM;
797+
trajectory = ownerVel * timeLeft * c_PPM;
797798

798799
const Vector nextPosition = position + trajectory;
799800
delta[X] = nextPosition.GetFloorIntX() - intPos[X];
@@ -924,7 +925,7 @@ namespace RTE {
924925
timeLeft *= (trajectory.GetMagnitude() - legProgress.GetMagnitude()) / prevTrajMag;
925926

926927
// The capped velocity used for the push calculations. a = F / m
927-
forceVel = Vector(velocity).CapMagnitude((pushForce * timeLeft) / mass);
928+
forceVel = Vector(ownerVel).CapMagnitude((pushForce * timeLeft) / mass);
928929

929930
// MOVABLEOBJECT COLLISION RESPONSE /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
930931

@@ -1149,11 +1150,11 @@ namespace RTE {
11491150
for (const std::pair<Vector, Vector> &impulseForcesEntry : impulseForces) {
11501151
// Cap the impulse to what the max push force is
11511152
//impulseForcesEntry.first.CapMagnitude(pushForce * (travelTime/* - timeLeft*/));
1152-
//velocity += impulseForcesEntry.first / mass;
1153+
ownerVel += impulseForcesEntry.first / mass;
11531154
returnPush += impulseForcesEntry.first;
11541155
}
11551156
// Stunt travel time if there is no more velocity
1156-
if (velocity.IsZero()) { timeLeft = 0; }
1157+
if (ownerVel.IsZero()) { timeLeft = 0; }
11571158
}
11581159
++stepCount;
11591160
}

0 commit comments

Comments
 (0)