Fixed physical history replay, it appears to be bitwise identical now (#498).
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/physics@10220 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
e37c225654
commit
d1e132fbcb
@ -537,6 +537,7 @@ void Kart::reset()
|
||||
m_bounce_back_time = 0.0f;
|
||||
m_skidding = 1.0f;
|
||||
m_time_last_crash = 0.0f;
|
||||
m_speed = 0.0f;
|
||||
m_view_blocked_by_plunger = 0.0f;
|
||||
|
||||
if(m_terrain_sound)
|
||||
@ -575,9 +576,12 @@ void Kart::reset()
|
||||
if (m_skidmarks)
|
||||
{
|
||||
m_skidmarks->reset();
|
||||
m_skidmarks->adjustFog( track_manager->getTrack( race_manager->getTrackName() )->isFogEnabled() );
|
||||
const Track *track =
|
||||
track_manager->getTrack( race_manager->getTrackName() );
|
||||
m_skidmarks->adjustFog(track->isFogEnabled() );
|
||||
}
|
||||
|
||||
m_vehicle->reset();
|
||||
for(int j=0; j<m_vehicle->getNumWheels(); j++)
|
||||
{
|
||||
m_vehicle->updateWheelTransform(j, true);
|
||||
|
@ -95,6 +95,21 @@ btWheelInfo& btKart::addWheel(const btVector3& connectionPointCS,
|
||||
return wheel;
|
||||
} // addWheel
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
/** Resets the kart before a (re)start, to make sure all physics variable
|
||||
* are properly defined. This is especially important for physics replay.
|
||||
*/
|
||||
void btKart::reset()
|
||||
{
|
||||
for(int i=0; i<getNumWheels(); i++)
|
||||
{
|
||||
btWheelInfo &wheel = m_wheelInfo[i];
|
||||
wheel.m_raycastInfo.m_suspensionLength = 0;
|
||||
wheel.m_rotation = 0;
|
||||
updateWheelTransformsWS(wheel);
|
||||
}
|
||||
} // reset
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
const btTransform& btKart::getWheelTransformWS( int wheelIndex ) const
|
||||
{
|
||||
|
@ -88,6 +88,7 @@ public:
|
||||
|
||||
virtual ~btKart() ;
|
||||
|
||||
void reset();
|
||||
|
||||
///btActionInterface interface
|
||||
virtual void updateAction( btCollisionWorld* collisionWorld, btScalar step)
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "io/file_manager.hpp"
|
||||
#include "modes/world.hpp"
|
||||
#include "karts/kart.hpp"
|
||||
#include "physics/physics.hpp"
|
||||
#include "race/race_manager.hpp"
|
||||
#include "tracks/track.hpp"
|
||||
#include "utils/constants.hpp"
|
||||
@ -131,10 +132,7 @@ void History::updateReplay(float dt)
|
||||
m_current = 0;
|
||||
// Note that for physics replay all physics parameters
|
||||
// need to be reset, e.g. velocity, ...
|
||||
for(unsigned int i=0; i<world->getNumKarts(); i++)
|
||||
{
|
||||
world->getKart(i)->reset();
|
||||
}
|
||||
world->restartRace();
|
||||
}
|
||||
unsigned int num_karts = world->getNumKarts();
|
||||
for(unsigned k=0; k<num_karts; k++)
|
||||
|
Loading…
x
Reference in New Issue
Block a user