From 14b49c58cb8b99c87dfe7d8b7b690f8c699bc1ba Mon Sep 17 00:00:00 2001 From: hikerstk Date: Mon, 4 May 2009 23:27:13 +0000 Subject: [PATCH] Worked around the 'kart shaking when braking' problem. git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/irrlicht@3465 178a84e3-b1eb-0310-8ba1-8eac791a3b58 --- src/physics/btKart.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/physics/btKart.cpp b/src/physics/btKart.cpp index 5ebcf4e40..7e77a385e 100644 --- a/src/physics/btKart.cpp +++ b/src/physics/btKart.cpp @@ -425,6 +425,14 @@ void btKart::updateFriction(btScalar timeStep) btScalar maxImpulse = wheelInfo.m_brake ? wheelInfo.m_brake : defaultRollingFrictionImpulse; btWheelContactPoint contactPt(m_chassisBody,groundObject,wheelInfo.m_raycastInfo.m_contactPointWS,m_forwardWS[wheel],maxImpulse); rollingFriction = calcRollingFriction(contactPt); + // This is a work around for the problem that a kart shakes + // if it is braking: we get a minor impulse forward, which + // bullet then tries to offset by applying a backward + // impulse - which is a bit too big, causing a impulse + // backwards, ... till the kart is shaking backwards and + // forwards + if(wheelInfo.m_brake && fabsf(rollingFriction)<10) + rollingFriction=0; } }