Fixed kart rotation ... again :)

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/irrlicht@3476 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk 2009-05-10 23:07:07 +00:00
parent 6bba0c2c28
commit be56804672

View File

@ -109,6 +109,13 @@ void Moveable::update(float dt)
m_motion_state->getWorldTransform(m_transform);
m_velocityLC = getVelocity()*getTrans().getBasis();
m_hpr.setHPR(m_transform.getBasis());
// roll is not set correctly, I assume due to a different HPR order.
// So we compute the proper roll (by taking the angle between the up
// vector and the rotated up vector).
Vec3 up(0,0,1);
Vec3 roll_vec = m_transform.getBasis()*up;
float roll = atan2(roll_vec.getX(), roll_vec.getZ());
m_hpr.setRoll(roll);
updateGraphics(Vec3(0,0,0), Vec3(0,0,0));
m_first_time = false ;