From 73b87f85407007a79b0a010ccfc2b87b613368a2 Mon Sep 17 00:00:00 2001 From: auria Date: Thu, 11 Nov 2010 01:03:15 +0000 Subject: [PATCH] Use squares when calculating 'vertical slipperiness', helps recover from jumps git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@6498 178a84e3-b1eb-0310-8ba1-8eac791a3b58 --- src/karts/kart.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/karts/kart.cpp b/src/karts/kart.cpp index b3b3665b0..cdfa7ad7a 100644 --- a/src/karts/kart.cpp +++ b/src/karts/kart.cpp @@ -1362,11 +1362,13 @@ void Kart::updatePhysics(float dt) float roll = fabsf(getRoll()); if (pitch > 0.25f) { - friction = std::min( friction, std::max(1.0f - (pitch - 0.25f) / 0.25f, 0.0f) ); + float x = std::min((pitch - 0.25f) / 0.25f, 1.0f); + friction = std::min( friction, 1.0f - x*x ); } if (roll > 0.25f) { - friction = std::min( friction, std::max(1.0f - (roll - 0.25f) / 0.25f, 0.0f) ); + float x = std::min((roll - 0.25f) / 0.25f, 1.0f); + friction = std::min( friction, 1.0f - x*x ); } } @@ -1385,7 +1387,7 @@ void Kart::updatePhysics(float dt) f -= 0.5f; printf("[%s] %f %f --> friction = %f\n", m_kart_properties->getIdent().c_str(), getPitch(), getRoll(), friction); } - */ + */ float steering = getMaxSteerAngle() * m_controls.m_steer*m_skidding;