1
0
mirror of https://github.com/rwengine/openrw.git synced 2024-09-18 16:32:32 +02:00

rwengine: Adapt the nominal engine force for our physics

This introduces a coefficient to adapt the nominal engine force to our
physics and ensure that top speed is not reached too fast.

Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
This commit is contained in:
Paul Kocialkowski 2018-08-02 19:04:12 +02:00
parent dce3b9af3a
commit 77b3df037e

View File

@ -310,7 +310,10 @@ void VehicleObject::tickPhysics(float dt) {
float velocity = collision->getBulletBody()->getLinearVelocity().length();
float velocityForward = physVehicle->getCurrentSpeedKmHour() / 3.6f;
float velocityMax = velFac / 9.f;
float engineForce = info->handling.acceleration * throttle * velFac;
// The engine force is calculated from the acceleration and max velocity
// of the vehicle, with a specific coefficient to make it adapted to
// Bullet physics and avoid reaching top speed too fast.
float engineForce = info->handling.acceleration * throttle * velFac / 1.2f;
float brakeF = getBraking();
// Mass coefficient, that quantifies how heavy a vehicle is and excludes
// light vehicles.