From fa4bdf88503d70abc951691385973fcc55005647 Mon Sep 17 00:00:00 2001 From: hikerstk Date: Thu, 8 Jan 2009 13:24:32 +0000 Subject: [PATCH] Bugfix: some karts would on some tracks not skid - caused by rounding problems (evil tux on the old race track for example). git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@2862 178a84e3-b1eb-0310-8ba1-8eac791a3b58 --- src/robots/default_robot.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/robots/default_robot.cpp b/src/robots/default_robot.cpp index 2d9ab3c24..3e937dbbd 100755 --- a/src/robots/default_robot.cpp +++ b/src/robots/default_robot.cpp @@ -650,8 +650,10 @@ float DefaultRobot::steerToPoint(const sgVec2 point, float dt) theta, angle_2_point, m_body->getAngularVelocity().getZ(), radius, sin_steer_angle); #endif - if(sin_steer_angle <= -1.0f) return -getMaxSteerAngle()*m_skidding_threshold; - if(sin_steer_angle >= 1.0f) return getMaxSteerAngle()*m_skidding_threshold; + // Add 0.1 since rouding errors will otherwise result in the kart + // not using drifting. + if(sin_steer_angle <= -1.0f) return -getMaxSteerAngle()*m_skidding_threshold-0.1f; + if(sin_steer_angle >= 1.0f) return getMaxSteerAngle()*m_skidding_threshold+0.1f; float steer_angle = asin(sin_steer_angle); return steer_angle; } // steerToPoint