Fixed replay mode.

This commit is contained in:
hiker 2014-11-27 22:34:04 +11:00
parent 020c129691
commit 71994c692f
2 changed files with 17 additions and 9 deletions

View File

@ -29,6 +29,7 @@
#include "io/file_manager.hpp"
#include "io/xml_node.hpp"
#include "karts/abstract_kart.hpp"
#include "karts/ghost_kart.hpp"
#include "karts/kart_properties.hpp"
#include "physics/btKart.hpp"
#include "utils/constants.hpp"
@ -780,16 +781,20 @@ void KartModel::update(float dt, float rotation_dt, float steer, float speed)
for(unsigned int i=0; i<4; i++)
{
if(!m_wheel_node[i]) continue;
const btWheelInfo &wi = m_kart->getVehicle()->getWheelInfo(i);
#ifdef DEBUG
if(UserConfigParams::m_physics_debug && m_kart)
float rel_suspension = 0;
if (!dynamic_cast<GhostKart*>(m_kart))
{
// Make wheels that are not touching the ground invisible
m_wheel_node[i]->setVisible(wi.m_raycastInfo.m_isInContact);
}
const btWheelInfo &wi = m_kart->getVehicle()->getWheelInfo(i);
#ifdef DEBUG
if (UserConfigParams::m_physics_debug && m_kart)
{
// Make wheels that are not touching the ground invisible
m_wheel_node[i]->setVisible(wi.m_raycastInfo.m_isInContact);
}
#endif
float rel_suspension = wi.m_raycastInfo.m_suspensionLength
- m_default_physics_suspension[i];
rel_suspension = wi.m_raycastInfo.m_suspensionLength
- m_default_physics_suspension[i];
}
// If the suspension is too compressed
if(rel_suspension< m_min_suspension[i])
rel_suspension = m_min_suspension[i];

View File

@ -23,6 +23,7 @@
#endif
#include "achievements/achievement_info.hpp"
#include "config/player_manager.hpp"
#include "karts/ghost_kart.hpp"
#include "karts/kart.hpp"
#include "karts/kart_gfx.hpp"
#include "karts/kart_properties.hpp"
@ -79,7 +80,9 @@ void Skidding::reset()
m_kart->getControls().m_skid = KartControl::SC_NONE;
btVector3 rot(0, 0, 0);
m_kart->getVehicle()->setTimedRotation(0, rot);
// Only access the vehicle if the kart is not a ghost
if (dynamic_cast<GhostKart*>(m_kart)==NULL)
m_kart->getVehicle()->setTimedRotation(0, rot);
} // reset
// ----------------------------------------------------------------------------