Fix speed weight object looping in non-animated character
This commit is contained in:
parent
fd7bf80493
commit
4c0b28a43e
@ -637,7 +637,10 @@ bool KartModel::loadModels(const KartProperties &kart_properties)
|
||||
#endif
|
||||
// Update min/max
|
||||
Vec3 obj_min, obj_max;
|
||||
MeshTools::minMax3D(obj.m_model, &obj_min, &obj_max);
|
||||
int frame = m_animation_frame[AF_SPEED_WEIGHTED_START];
|
||||
if (frame < 0)
|
||||
frame = 0;
|
||||
MeshTools::minMax3D(obj.m_model->getMesh(frame), &obj_min, &obj_max);
|
||||
obj_min += obj.m_position;
|
||||
obj_max += obj.m_position;
|
||||
kart_min.min(obj_min);
|
||||
@ -1026,15 +1029,6 @@ void KartModel::update(float dt, float distance, float steer, float speed,
|
||||
m_wheel_node[i]->setRotation(wheel_rotation);
|
||||
} // for (i < 4)
|
||||
|
||||
// If animations are disabled, stop here
|
||||
if (m_animated_node == NULL) return;
|
||||
|
||||
if (m_play_non_loop && m_animated_node->getLoopMode() == true)
|
||||
{
|
||||
m_play_non_loop = false;
|
||||
this->setAnimation(AF_DEFAULT);
|
||||
}
|
||||
|
||||
// Update the speed-weighted objects' animations
|
||||
if (m_kart != NULL)
|
||||
{
|
||||
@ -1088,6 +1082,15 @@ void KartModel::update(float dt, float distance, float steer, float speed,
|
||||
}
|
||||
}
|
||||
|
||||
// If animations are disabled, stop here
|
||||
if (m_animated_node == NULL) return;
|
||||
|
||||
if (m_play_non_loop && m_animated_node->getLoopMode() == true)
|
||||
{
|
||||
m_play_non_loop = false;
|
||||
this->setAnimation(AF_DEFAULT);
|
||||
}
|
||||
|
||||
// Check if the end animation is being played, if so, don't
|
||||
// play steering animation.
|
||||
if(m_current_animation!=AF_DEFAULT) return;
|
||||
|
Loading…
Reference in New Issue
Block a user