Applied Chris Morris patch 2968849: make the torque after an

explosion dependent on distance to avoid karts shaking that
are way too far to be affected at all.


git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@5012 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk
2010-03-17 02:46:12 +00:00
parent 09781b9221
commit 124e719d11

View File

@@ -640,7 +640,7 @@ void Kart::handleExplosion(const Vec3& pos, bool direct_hit)
getVehicle()->getRigidBody()->applyCentralImpulse(diff);
// Even if just pushed, give some random rotation to simulate the lost of control by the shake
float sign_a = (sign_bits & (0x1 << 8)) ? 1.0f : -1.0f;
getVehicle()->getRigidBody()->applyTorqueImpulse(btVector3(0, sign_a * float(rand()%32*5), 0));
getVehicle()->getRigidBody()->applyTorqueImpulse(btVector3(0, sign_a * float(rand()%32*5)/sqrt(len2), 0));
} // if direct_hit
} // handleExplosion