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
This commit is contained in:
hikerstk 2009-01-08 13:24:32 +00:00
parent 3ca8f80253
commit fa4bdf8850

View File

@ -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