From c6f7448911fab31164525e8d31fc7474c11a945b Mon Sep 17 00:00:00 2001 From: hiker Date: Thu, 21 Aug 2014 22:34:51 +1000 Subject: [PATCH] Use sqrt(speed) to scale the collision impulse, which results in weaker impulses when hitting the terrain. --- data/stk_config.xml | 2 +- src/karts/kart.cpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/data/stk_config.xml b/data/stk_config.xml index 81135667a..5e0fdfbe0 100644 --- a/data/stk_config.xml +++ b/data/stk_config.xml @@ -421,7 +421,7 @@ outside of the chassis and results in more stable physical behaviour of the karts. --> diff --git a/src/karts/kart.cpp b/src/karts/kart.cpp index 5dffe87e7..b84ca215c 100644 --- a/src/karts/kart.cpp +++ b/src/karts/kart.cpp @@ -1765,9 +1765,9 @@ void Kart::crashed(const Material *m, const Vec3 &normal) impulse.normalize(); else impulse = Vec3(0, 0, -1); // Arbitrary - // impulse depends of kart speed - impulse *= 0.2f * m_body->getLinearVelocity().length(); - impulse *= m_kart_properties->getCollisionTerrainImpulse(); + // impulse depends of kart speed - and speed can be negative + impulse *= sqrt(fabsf(getSpeed())) + * m_kart_properties->getCollisionTerrainImpulse(); m_bounce_back_time = 0.2f; m_vehicle->setTimedCentralImpulse(0.1f, impulse); }