Removed shadows when the kart is not on the ground (work around

for the problem that shadows are glued under the kart, even if
the kart is in the air).


git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@2939 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk 2009-01-16 00:37:31 +00:00
parent 97c2df5d12
commit 165c196ef2

View File

@ -76,6 +76,8 @@ Kart::Kart (const std::string& kart_name, int position,
m_eliminated = false;
m_finished_race = false;
m_finish_time = 0.0f;
m_shadow_enabled = false;
m_shadow = NULL;
m_smoke_system = NULL;
m_nitro = NULL;
m_skidmarks = NULL;
@ -635,6 +637,18 @@ void Kart::update(float dt)
// Check if any item was hit.
item_manager->hitItem(this);
m_skidmarks->update(dt);
// Remove the shadow if the kart is not on the ground
if(!isOnGround() && m_shadow_enabled)
{
m_shadow_enabled = false;
m_model_transform->removeKid(m_shadow);
}
if(isOnGround() && !m_shadow_enabled)
{
m_shadow_enabled = true;
m_model_transform->addKid(m_shadow);
}
} // update
//-----------------------------------------------------------------------------
@ -981,6 +995,7 @@ void Kart::loadData()
m_shadow = createShadow(m_kart_properties->getShadowFile(), -1, 1, -1, 1);
m_shadow->ref();
m_model_transform->addKid ( m_shadow );
m_shadow_enabled = true;
} // loadData
//-----------------------------------------------------------------------------