diff --git a/src/karts/kart.cpp b/src/karts/kart.cpp index aed63f112..f3acdec39 100644 --- a/src/karts/kart.cpp +++ b/src/karts/kart.cpp @@ -119,7 +119,7 @@ Kart::Kart (const std::string& ident, Track* track, int position, bool is_first_ // Set position and heading: m_reset_transform = init_transform; m_speed = 0.0f; - m_wheel_rotation = 0; + m_wheel_rotation = 0; m_kart_model->setKart(this); @@ -292,6 +292,7 @@ void Kart::createPhysics() wheel.m_wheelsDampingCompression = m_kart_properties->getWheelDampingCompression(); wheel.m_frictionSlip = m_kart_properties->getFrictionSlip(); wheel.m_rollInfluence = m_kart_properties->getRollInfluence(); + wheel.m_rotation = int(m_kart_properties->hasRandomWheels()) * (rand() % 360); } // Obviously these allocs have to be properly managed/freed btTransform t; diff --git a/src/karts/kart_properties.cpp b/src/karts/kart_properties.cpp index a109ae605..b9e09f219 100644 --- a/src/karts/kart_properties.cpp +++ b/src/karts/kart_properties.cpp @@ -101,6 +101,7 @@ KartProperties::KartProperties(const std::string &filename) m_shape = 32; // close enough to a circle. m_engine_sfx_type = "engine_small"; m_kart_model = NULL; + m_has_rand_wheels = false; // The default constructor for stk_config uses filename="" if (filename != "") load(filename, "kart"); } // KartProperties @@ -238,6 +239,8 @@ void KartProperties::getAllData(const XMLNode * root) root->get("groups", &m_groups ); + root->get("RandomWheelRot", &m_has_rand_wheels ); + if(const XMLNode *dimensions_node = root->getNode("center")) dimensions_node->get("gravity-shift", &m_gravity_center_shift); diff --git a/src/karts/kart_properties.hpp b/src/karts/kart_properties.hpp index f3dae4420..ae2157c46 100644 --- a/src/karts/kart_properties.hpp +++ b/src/karts/kart_properties.hpp @@ -304,6 +304,8 @@ private: void load (const std::string &filename, const std::string &node); + /** If the kart is supposed to have random wheel rotation at start. */ + bool m_has_rand_wheels; public: KartProperties (const std::string &filename=""); @@ -630,6 +632,7 @@ public: /** Returns how long it takes for the swatter to swat at an item. */ float getSwatterItemAnimationTime() const {return m_swatter_item_animation_time; } + bool hasRandomWheels() const { return m_has_rand_wheels; } }; // KartProperties #endif