Made turning of cannon animations smoother (by using a weighted

average of previous and new heading).


git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@11173 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk
2012-04-29 12:11:16 +00:00
parent 78e09b4d1b
commit 5e9b555afe

View File

@@ -100,10 +100,11 @@ void CannonAnimation::update(float dt)
// the previous rotation is kept.
if(xyz!=m_previous_orig_xyz)
{
btQuaternion prev_rot = m_kart->getRotation();
core::vector3df rot = (xyz-m_previous_orig_xyz).toIrrVector()
.getHorizontalAngle();
btQuaternion q(Vec3(0,1,0),rot.Y*DEGREE_TO_RAD);
m_kart->setRotation(q);
m_kart->setRotation(prev_rot.slerp(q,0.1f));
}
m_previous_orig_xyz = xyz;