From 09eaaebd64a62342759d0c260c56dcd07aac9611 Mon Sep 17 00:00:00 2001 From: auria Date: Mon, 29 Nov 2010 21:50:45 +0000 Subject: [PATCH] Minor: make fly mode easier to use by preventing kart from rolling when turning git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@6780 178a84e3-b1eb-0310-8ba1-8eac791a3b58 --- src/karts/kart.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/karts/kart.cpp b/src/karts/kart.cpp index 2786c5de3..12f6c097a 100644 --- a/src/karts/kart.cpp +++ b/src/karts/kart.cpp @@ -1142,6 +1142,14 @@ void Kart::updatePhysics(float dt) //float orientation = getHeading(); //m_body->applyCentralImpulse(btVector3(-60.0f*sin(orientation), 0.0, -60.0f*cos(orientation))); } + + // dampen any roll while flying, makes the kart hard to control + btVector3 velocity = m_body->getAngularVelocity(); + const float z = velocity.z(); + if (z > 0.1f) velocity.setZ(z - 0.1f); + else if (z < -0.1f) velocity.setZ(z + 0.1f); + else velocity.setZ(0); + m_body->setAngularVelocity(velocity); }