Fixed flicker that sometimes occured when stopping model rotation

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/irrlicht@4159 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria
2009-10-29 00:16:37 +00:00
parent 8158bc01b0
commit b605c31345

View File

@@ -108,6 +108,12 @@ void ModelViewWidget::update(float delta)
angle -= delta*m_rotation_speed;
}
// slow down when getting close
if (fabsf(angle - m_rotation_target) < m_rotation_speed*5.0f)
{
m_rotation_speed = std::max(m_rotation_speed*0.9f, fabsf(angle - m_rotation_target));
}
// stop rotating when target reached
if (fabsf(angle - m_rotation_target) < 2.0f) m_rotation_mode = ROTATE_OFF;
}