summaryrefslogtreecommitdiffstats
path: root/src/vehicles/HandlingMgr.cpp
diff options
context:
space:
mode:
authoraap <aap@papnet.eu>2021-01-02 20:15:07 +0100
committeraap <aap@papnet.eu>2021-01-02 20:15:07 +0100
commitec1e8b6c86de51ffd00513bffa21fee20952c601 (patch)
tree8ac76c19a5e24d0b13abbc097e82d9c0135c8374 /src/vehicles/HandlingMgr.cpp
parentold line was better (until we know whats going on) (diff)
downloadre3-ec1e8b6c86de51ffd00513bffa21fee20952c601.tar
re3-ec1e8b6c86de51ffd00513bffa21fee20952c601.tar.gz
re3-ec1e8b6c86de51ffd00513bffa21fee20952c601.tar.bz2
re3-ec1e8b6c86de51ffd00513bffa21fee20952c601.tar.lz
re3-ec1e8b6c86de51ffd00513bffa21fee20952c601.tar.xz
re3-ec1e8b6c86de51ffd00513bffa21fee20952c601.tar.zst
re3-ec1e8b6c86de51ffd00513bffa21fee20952c601.zip
Diffstat (limited to '')
-rw-r--r--src/vehicles/HandlingMgr.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/vehicles/HandlingMgr.cpp b/src/vehicles/HandlingMgr.cpp
index 51110507..b03c1213 100644
--- a/src/vehicles/HandlingMgr.cpp
+++ b/src/vehicles/HandlingMgr.cpp
@@ -362,15 +362,21 @@ cHandlingDataMgr::ConvertDataToGameUnits(tHandlingData *handling)
handling->fCollisionDamageMultiplier *= 2000.0f/handling->fMass;
handling->fBuoyancy = 100.0f/handling->nPercentSubmerged * GRAVITY*handling->fMass;
- // What the hell is going on here?
- specificVolume = handling->Dimension.x*handling->Dimension.z*0.5f / handling->fMass; // ?
+ // Don't quite understand this. What seems to be going on is that
+ // we calculate a drag (air resistance) deceleration for a given velocity and
+ // find the intersection between that and the max engine acceleration.
+ // at that point the car cannot accelerate any further and we've found the max velocity.
a = 0.0f;
b = 100.0f;
velocity = handling->Transmission.fMaxVelocity;
while(a < b && velocity > 0.0f){
velocity -= 0.01f;
+ // what's the 1/6?
a = handling->Transmission.fEngineAcceleration/6.0f;
- b = -velocity * (1.0f/(specificVolume * sq(velocity) + 1.0f) - 1.0f);
+ // no density or drag coefficient here...
+ float a_drag = 0.5f*SQR(velocity) * handling->Dimension.x*handling->Dimension.z / handling->fMass;
+ // can't make sense of this... maybe v - v/(drag + 1) ? but that doesn't make so much sense either
+ b = -velocity * (1.0f/(a_drag + 1.0f) - 1.0f);
}
if(handling->nIdentifier == HANDLING_RCBANDIT){