Replace the fricition material flag with a simpler boolean (anyway the previous value was only used like a boolean)
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@9116 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
@@ -76,7 +76,7 @@ Material::Material(const XMLNode *node, int index)
|
||||
node->get("alpha", &m_alpha_blending );
|
||||
node->get("light", &m_lighting );
|
||||
node->get("sphere", &m_sphere_map );
|
||||
node->get("friction", &m_friction );
|
||||
node->get("high-adhesion", &m_high_tire_adhesion);
|
||||
node->get("reset", &m_drive_reset );
|
||||
node->get("crash-reset", &m_crash_reset );
|
||||
node->get("below-surface", &m_below_surface );
|
||||
@@ -228,7 +228,7 @@ void Material::init(unsigned int index)
|
||||
m_lighting = true;
|
||||
m_backface_culling = true;
|
||||
m_sphere_map = false;
|
||||
m_friction = 1.0f;
|
||||
m_high_tire_adhesion = false;
|
||||
m_below_surface = false;
|
||||
m_falling_effect = false;
|
||||
m_surface = false;
|
||||
|
||||
@@ -115,7 +115,7 @@ private:
|
||||
m_adjust_image;
|
||||
/** True if lightmapping is enabled for this material. */
|
||||
bool m_lightmap;
|
||||
float m_friction;
|
||||
bool m_high_tire_adhesion;
|
||||
/** How much the top speed is reduced per second. */
|
||||
float m_slowdown_time;
|
||||
/** Maximum speed at which no more slow down occurs. */
|
||||
@@ -176,7 +176,7 @@ public:
|
||||
/** Returns if this material should trigger a rescue if a kart
|
||||
* crashes against it. */
|
||||
bool isCrashReset () const { return m_crash_reset; }
|
||||
float getFriction () const { return m_friction; }
|
||||
bool highTireAdhesion () const { return m_high_tire_adhesion; }
|
||||
const std::string&
|
||||
getTexFname () const { return m_texname; }
|
||||
int getIndex () const { return m_index; }
|
||||
|
||||
@@ -1591,15 +1591,14 @@ void Kart::updatePhysics(float dt)
|
||||
float friction = 1.0f;
|
||||
bool enable_skidding = false;
|
||||
|
||||
// If a material has friction of more than 10000 treat this
|
||||
// as no-skidding possible. This way the current skidding
|
||||
// This way the current skidding
|
||||
// handling can be disabled for certain material (e.g. the
|
||||
// curve in skyline on which otherwise karts could not drive).
|
||||
// We also had a crash reported here, which was caused by not
|
||||
// having a material here - no idea how this could have happened,
|
||||
// but this problem is now avoided by testing if there is a material
|
||||
if (isOnGround() &&
|
||||
(!getMaterial() || getMaterial()->getFriction()<10000.0f))
|
||||
(!getMaterial() || !getMaterial()->highTireAdhesion()))
|
||||
{
|
||||
const btMatrix3x3 &m = m_vehicle->getChassisWorldTransform().getBasis();
|
||||
// To get the angle between up=(0,1,0), we have to do:
|
||||
|
||||
Reference in New Issue
Block a user