Use sqrt(speed) to scale the collision impulse, which results in

weaker impulses when hitting the terrain.
This commit is contained in:
hiker 2014-08-21 22:34:51 +10:00
parent 1179ebf4e9
commit c6f7448911
2 changed files with 4 additions and 4 deletions

View File

@ -421,7 +421,7 @@
outside of the chassis and results in more stable physical outside of the chassis and results in more stable physical
behaviour of the karts. --> behaviour of the karts. -->
<collision impulse-type="normal" <collision impulse-type="normal"
impulse="3000" impulse-time="0.1" terrain-impulse="8000" impulse="3000" impulse-time="0.1" terrain-impulse="1600"
restitution="1.0" bevel-factor="0.5 0.0 0.7" restitution="1.0" bevel-factor="0.5 0.0 0.7"
physical-wheel-position="-1" /> physical-wheel-position="-1" />

View File

@ -1765,9 +1765,9 @@ void Kart::crashed(const Material *m, const Vec3 &normal)
impulse.normalize(); impulse.normalize();
else else
impulse = Vec3(0, 0, -1); // Arbitrary impulse = Vec3(0, 0, -1); // Arbitrary
// impulse depends of kart speed // impulse depends of kart speed - and speed can be negative
impulse *= 0.2f * m_body->getLinearVelocity().length(); impulse *= sqrt(fabsf(getSpeed()))
impulse *= m_kart_properties->getCollisionTerrainImpulse(); * m_kart_properties->getCollisionTerrainImpulse();
m_bounce_back_time = 0.2f; m_bounce_back_time = 0.2f;
m_vehicle->setTimedCentralImpulse(0.1f, impulse); m_vehicle->setTimedCentralImpulse(0.1f, impulse);
} }