From 4dcde604b16506ba99e09e4506cc73f9d31c70ef Mon Sep 17 00:00:00 2001 From: hikerstk Date: Mon, 10 Sep 2007 00:36:50 +0000 Subject: [PATCH] Bullet only: fixed --history function for bullet physics. git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@1234 178a84e3-b1eb-0310-8ba1-8eac791a3b58 --- src/kart.cpp | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/src/kart.cpp b/src/kart.cpp index cecb729a5..ee233977e 100644 --- a/src/kart.cpp +++ b/src/kart.cpp @@ -1508,25 +1508,29 @@ void Kart::placeModel () // We don't have to call Moveable::placeModel, since it does only setTransform #ifdef BULLET - btTransform t; - if(m_rescue) + // Only transfer the bullet data to the plib tree if no history is being + // replayed. + if(!user_config->m_replay_history) { - t=m_kart_body->getCenterOfMassTransform(); - // m_motion_state->getWorldTransform(t); - } - else - { - m_motion_state->getWorldTransform(t); + btTransform t; + if(m_rescue) + { + t=m_kart_body->getCenterOfMassTransform(); + // m_motion_state->getWorldTransform(t); + } + else + { + m_motion_state->getWorldTransform(t); + } + float m[4][4]; + t.getOpenGLMatrix((float*)&m); + + //printf(" is %f %f %f\n",t.getOrigin().x(),t.getOrigin().y(),t.getOrigin().z()); + // Transfer the new position and hpr to m_curr_pos + sgSetCoord(&m_curr_pos, m); + const btVector3 &v=m_kart_body->getLinearVelocity(); + sgSetVec3(m_velocity.xyz, v.x(), v.y(), v.z()); } - float m[4][4]; - t.getOpenGLMatrix((float*)&m); - - //printf(" is %f %f %f\n",t.getOrigin().x(),t.getOrigin().y(),t.getOrigin().z()); - // Transfer the new position and hpr to m_curr_pos - sgSetCoord(&m_curr_pos, m); - const btVector3 &v=m_kart_body->getLinearVelocity(); - sgSetVec3(m_velocity.xyz, v.x(), v.y(), v.z()); - sgCoord c ; sgCopyCoord ( &c, &m_curr_pos ) ; // c.hpr[1] += m_wheelie_angle ;