Now skidding's particle are just under wheels

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@12921 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
samuncle 2013-06-23 13:42:08 +00:00
parent 5a6737b6a8
commit a6d3b2019b
4 changed files with 21 additions and 1 deletions

View File

@ -53,6 +53,7 @@ AbstractKart::AbstractKart(const std::string& ident,
m_kart_width = m_kart_model->getWidth();
m_kart_height = m_kart_model->getHeight();
m_kart_length = m_kart_model->getLength();
m_wheel_graphics_position = m_kart_model->getWheelsGraphicsPosition();
} // AbstractKart
// ----------------------------------------------------------------------------

View File

@ -51,6 +51,8 @@ private:
float m_kart_width;
/** Height of the kart, copy of the data from KartModel. */
float m_kart_height;
/** The position of all four wheels in the 3d model */
const Vec3* m_wheel_graphics_position;
/** Index of kart in world. */
unsigned int m_world_kart_id;
@ -147,6 +149,12 @@ public:
// ------------------------------------------------------------------------
/** Returns true if this kart has no wheels. */
bool isWheeless() const;
// ------------------------------------------------------------------------
/** Returns the position of a wheel relative to the kart.
* \param i Index of the wheel: 0=front right, 1 = front left, 2 = rear
* right, 3 = rear left. */
const Vec3& getWheelGraphicsPosition(int i) const
{assert(i>=0 && i<4); return m_wheel_graphics_position[i];}
// ========================================================================
// Emergency animation related functions.

View File

@ -40,12 +40,18 @@ KartGFX::KartGFX(const AbstractKart *kart)
}
m_kart = kart;
/*
// FIXME Old Positioning system Maybe usefull for another effect
Vec3 rear_left(-(kart->getKartWidth()+0.20f)*0.35f, (kart->getKartHeight()-0.6f)*0.35f,
-kart->getKartLength()*0.35f);
Vec3 rear_right((kart->getKartWidth()+0.20f)*0.35f, (kart->getKartHeight()-0.6f)*0.35f,
-kart->getKartLength()*0.35f);
*/
Vec3 rear_left(kart->getWheelGraphicsPosition(3).toIrrVector().X, (kart->getKartHeight()-0.6f)*0.35f,
kart->getWheelGraphicsPosition(3).toIrrVector().Z);
Vec3 rear_right(kart->getWheelGraphicsPosition(2).toIrrVector().X, (kart->getKartHeight()-0.6f)*0.35f,
kart->getWheelGraphicsPosition(2).toIrrVector().Z);
Vec3 rear_center(0, kart->getKartHeight()*0.35f,
-kart->getKartLength()*0.35f);

View File

@ -181,6 +181,11 @@ public:
const Vec3& getWheelGraphicsPosition(int i) const
{assert(i>=0 && i<4); return m_wheel_graphics_position[i];}
// ------------------------------------------------------------------------
/** Returns the position of wheels relative to the kart.
*/
const Vec3* getWheelsGraphicsPosition() const
{return m_wheel_graphics_position;}
// ------------------------------------------------------------------------
/** Returns the position of a wheel relative to the kart for the physics.
* The physics wheels can be attached at a different place to make the
* karts more stable.