Nitro and skidding gfx improvements
- skidding effect shouldn't depend on height of the kart - workaround for karts which don't have nitro emitters git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@14202 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
77e7ff57ab
commit
3a73436d3e
@ -55,6 +55,7 @@ AbstractKart::AbstractKart(const std::string& ident,
|
||||
m_kart_length = m_kart_model->getLength();
|
||||
m_wheel_graphics_position = m_kart_model->getWheelsGraphicsPosition();
|
||||
m_nitro_emitter_position = m_kart_model->getNitroEmittersPositon();
|
||||
m_has_nitro_emitter = m_kart_model->hasNitroEmitters();
|
||||
} // AbstractKart
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
@ -55,6 +55,8 @@ private:
|
||||
const Vec3* m_wheel_graphics_position;
|
||||
/** The position of all nitro emitters in the 3d model */
|
||||
const Vec3* m_nitro_emitter_position;
|
||||
/** True if kart has nitro emitters */
|
||||
bool m_has_nitro_emitter;
|
||||
|
||||
/** Index of kart in world. */
|
||||
unsigned int m_world_kart_id;
|
||||
@ -161,6 +163,10 @@ public:
|
||||
/** Returns the position of a nitro emitter relative to the kart */
|
||||
const Vec3& getNitroEmitterPosition(int i) const
|
||||
{assert(i>=0 && i<2); return m_nitro_emitter_position[i];}
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns true if kart has nitro emitters */
|
||||
const bool hasNitroEmitter() const
|
||||
{return m_has_nitro_emitter;}
|
||||
|
||||
// ========================================================================
|
||||
// Emergency animation related functions.
|
||||
|
@ -50,13 +50,16 @@ KartGFX::KartGFX(const AbstractKart *kart)
|
||||
|
||||
|
||||
*/
|
||||
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_left(kart->getWheelGraphicsPosition(3).toIrrVector().X, 0.05f,
|
||||
kart->getWheelGraphicsPosition(3).toIrrVector().Z-0.1f);
|
||||
Vec3 rear_right(kart->getWheelGraphicsPosition(2).toIrrVector().X, 0.05f,
|
||||
kart->getWheelGraphicsPosition(2).toIrrVector().Z-0.1f);
|
||||
|
||||
Vec3 rear_center(0, kart->getKartHeight()*0.35f,
|
||||
-kart->getKartLength()*0.35f);
|
||||
|
||||
Vec3 rear_nitro_center(0, kart->getKartHeight()*0.15f,
|
||||
-kart->getKartLength()*0.1f);
|
||||
|
||||
// FIXME Used to match the emitter as seen in blender
|
||||
const float delta = 0.6f;
|
||||
@ -67,6 +70,8 @@ KartGFX::KartGFX(const AbstractKart *kart)
|
||||
Vec3 rear_nitro_left(kart->getNitroEmitterPosition(1).toIrrVector().X,
|
||||
kart->getNitroEmitterPosition(1).toIrrVector().Y,
|
||||
kart->getNitroEmitterPosition(1).toIrrVector().Z + delta);
|
||||
if (!kart->hasNitroEmitter())
|
||||
rear_nitro_right = rear_nitro_left = rear_nitro_center;
|
||||
|
||||
// Create all effects. Note that they must be created
|
||||
// in the order of KartGFXType.
|
||||
|
@ -135,13 +135,14 @@ void KartModel::loadInfo(const XMLNode &node)
|
||||
}
|
||||
|
||||
m_nitro_emitter_position[0] = Vec3 (0,0.1f,0);
|
||||
|
||||
m_nitro_emitter_position[1] = Vec3 (0,0.1f,0);
|
||||
m_has_nitro_emitter = false;
|
||||
|
||||
if(const XMLNode *nitroEmitter_node=node.getNode("nitro-emitter"))
|
||||
{
|
||||
loadNitroEmitterInfo(*nitroEmitter_node, "nitro-emitter-a", 0);
|
||||
loadNitroEmitterInfo(*nitroEmitter_node, "nitro-emitter-b", 1);
|
||||
m_has_nitro_emitter = true;
|
||||
}
|
||||
|
||||
if(const XMLNode *hat_node=node.getNode("hat"))
|
||||
@ -231,6 +232,7 @@ KartModel* KartModel::makeCopy()
|
||||
|
||||
km->m_nitro_emitter_position[0] = m_nitro_emitter_position[0];
|
||||
km->m_nitro_emitter_position[1] = m_nitro_emitter_position[1];
|
||||
km->m_has_nitro_emitter = m_has_nitro_emitter;
|
||||
|
||||
for(unsigned int i=0; i<4; i++)
|
||||
{
|
||||
|
@ -120,6 +120,9 @@ private:
|
||||
/** The position of the nitro emitters */
|
||||
Vec3 m_nitro_emitter_position[2];
|
||||
|
||||
/** True if kart has nitro emitters */
|
||||
bool m_has_nitro_emitter;
|
||||
|
||||
/** Minimum suspension length. If the displayed suspension is
|
||||
* shorter than this, the wheel would look wrong. */
|
||||
float m_min_suspension[4];
|
||||
@ -214,6 +217,10 @@ public:
|
||||
const Vec3* getNitroEmittersPositon() const
|
||||
{return m_nitro_emitter_position;}
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns true if kart has nitro emitters */
|
||||
const bool hasNitroEmitters() const
|
||||
{return m_has_nitro_emitter;}
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns the length of the kart model. */
|
||||
float getLength () const {return m_kart_length; }
|
||||
// ------------------------------------------------------------------------
|
||||
|
Loading…
x
Reference in New Issue
Block a user