diff --git a/src/camera.cpp b/src/camera.cpp index 1c77a8022..ab7ab02b1 100644 --- a/src/camera.cpp +++ b/src/camera.cpp @@ -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]; diff --git a/src/world.cpp b/src/world.cpp index 1107d7d20..deb58b100 100644 --- a/src/world.cpp +++ b/src/world.cpp @@ -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);