Improved support for karts without wheels (up to now Gnu had

invisible wheel models).


git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@6026 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk 2010-09-16 12:19:00 +00:00
parent 286d12a5f2
commit 8c8d8de7f4
2 changed files with 8 additions and 4 deletions

View File

@ -74,6 +74,8 @@ void ModelViewWidget::clearModels()
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
void ModelViewWidget::addModel(irr::scene::IMesh* mesh, const Vec3& location, const int frame) void ModelViewWidget::addModel(irr::scene::IMesh* mesh, const Vec3& location, const int frame)
{ {
if(!mesh) return;
m_models.push_back(mesh); m_models.push_back(mesh);
m_model_location.push_back(location); m_model_location.push_back(location);
m_model_frames.push_back(frame); m_model_frames.push_back(frame);

View File

@ -203,6 +203,7 @@ void KartModel::attachModel(scene::ISceneNode **node)
for(unsigned int i=0; i<4; i++) for(unsigned int i=0; i<4; i++)
{ {
if(!m_wheel_model[i]) continue;
m_wheel_node[i] = irr_driver->addMesh(m_wheel_model[i], m_wheel_node[i] = irr_driver->addMesh(m_wheel_model[i],
*node); *node);
m_wheel_node[i]->grab(); m_wheel_node[i]->grab();
@ -433,14 +434,15 @@ void KartModel::update(float rotation, float visual_steer,
for(unsigned int i=0; i<4; i++) for(unsigned int i=0; i<4; i++)
{ {
if(!m_wheel_node[i]) continue;
core::vector3df pos = m_wheel_graphics_position[i].toIrrVector(); core::vector3df pos = m_wheel_graphics_position[i].toIrrVector();
pos.Y += clamped_suspension[i]; pos.Y += clamped_suspension[i];
m_wheel_node[i]->setPosition(pos); m_wheel_node[i]->setPosition(pos);
} }
m_wheel_node[0]->setRotation(wheel_front); if(m_wheel_node[0]) m_wheel_node[0]->setRotation(wheel_front);
m_wheel_node[1]->setRotation(wheel_front); if(m_wheel_node[1]) m_wheel_node[1]->setRotation(wheel_front);
m_wheel_node[2]->setRotation(wheel_rear ); if(m_wheel_node[2]) m_wheel_node[2]->setRotation(wheel_rear );
m_wheel_node[3]->setRotation(wheel_rear ); if(m_wheel_node[3]) m_wheel_node[3]->setRotation(wheel_rear );
// Check if the end animation is being played, if so, don't // Check if the end animation is being played, if so, don't
// play steering animation. // play steering animation.