1
0
mirror of https://github.com/rwengine/openrw.git synced 2024-11-23 02:42:39 +01:00

rwengine: Increase the engine force based on the mass

Since heavy vehicles have more inertia, they require more engine force
to be moved sufficiently fast. Without this extra force, many heavy
vehicles are unbearably slow to drive. Reuse the mass coefficient that
was introduced to increase the engine force accordingly.

Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
This commit is contained in:
Paul Kocialkowski 2018-08-01 23:48:27 +02:00
parent 6c66f61519
commit 3ae98dd93a

View File

@ -316,6 +316,10 @@ void VehicleObject::tickPhysics(float dt) {
// light vehicles. // light vehicles.
float kM = (std::max(1500.f, info->handling.mass) - 1500.f) / 1500.f; float kM = (std::max(1500.f, info->handling.mass) - 1500.f) / 1500.f;
// Increase the engine force based on the mass by up to 4 times.
// Heavy vehicles need extra engine force to be reactive enough.
engineForce *= std::min(1.f + kM, 4.f);
if (velocity > velocityMax) { if (velocity > velocityMax) {
btVector3 v = collision->getBulletBody()->getLinearVelocity().normalized(); btVector3 v = collision->getBulletBody()->getLinearVelocity().normalized();