1) Increased number of physic simulation steps before the race is started to

make sure that all karts are firmly on the ground.
2) Avoid changing the pitch of the camera during race startup. 


git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@1477 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk 2008-02-13 03:42:18 +00:00
parent 0bf192c068
commit 4562dec6b6
2 changed files with 19 additions and 9 deletions

View File

@ -132,15 +132,20 @@ void Camera::update (float dt)
// Use the terrain pitch to avoid the camera following a wheelie the kart is doing
kartcoord.hpr[1]=RAD_TO_DEGREE( kart->getTerrainPitch(DEGREE_TO_RAD(kartcoord.hpr[0])) );
kartcoord.hpr[2] = 0;
// If the terrain pitch is 'significantly' different from the camera angle,
// start adjusting the camera. This helps with steep declines, where
// otherwise the track is not visible anymore.
if(fabsf(kartcoord.hpr[1]-m_LastPitch)>1.0f) {
kartcoord.hpr[1] = m_LastPitch + (kartcoord.hpr[1]-m_LastPitch)*2.0f*dt;
}
else
// Only adjust the pitch if it's not the first frame (which is indicated by having
// dt=0). Otherwise the camera will change pitch during ready-set-go.
if(dt>0)
{
kartcoord.hpr[1]=m_LastPitch;
// If the terrain pitch is 'significantly' different from the camera angle,
// start adjusting the camera. This helps with steep declines, where
// otherwise the track is not visible anymore.
if(fabsf(kartcoord.hpr[1]-m_LastPitch)>1.0f) {
kartcoord.hpr[1] = m_LastPitch + (kartcoord.hpr[1]-m_LastPitch)*2.0f*dt;
}
else
{
kartcoord.hpr[1]=m_LastPitch;
}
}
m_LastPitch = kartcoord.hpr[1];

View File

@ -224,7 +224,12 @@ World::~World()
void World::resetAllKarts()
{
bool all_finished=false;
for(int i=0; i<10; i++) m_physics->update(1.f/60.f);
// kart->isInRest() is not fully correct, since it only takes the
// velocity in count, which might be close to zero when the kart
// is just hitting the floor, before being pushed up again by
// the suspension. So we just do a longer initial simulation,
// which should be long enough for all karts to be firmly on ground.
for(int i=0; i<100; i++) m_physics->update(1.f/60.f);
while(!all_finished)
{
m_physics->update(1.f/60.f);