diff --git a/src/graphics/camera.cpp b/src/graphics/camera.cpp index 597955ec2..dab24b176 100644 --- a/src/graphics/camera.cpp +++ b/src/graphics/camera.cpp @@ -287,7 +287,7 @@ void Camera::reset() void Camera::setInitialTransform() { if (m_kart == NULL) return; - Vec3 start_offset(0, 2, -5); + Vec3 start_offset(0, 1.6, -3.5); Vec3 xx = m_kart->getTrans()(start_offset); m_camera->setPosition( xx.toIrrVector()); // Reset the target from the previous target (in case of a restart @@ -328,8 +328,8 @@ void Camera::smoothMoveCamera(float dt) float skid_angle = asin(skid_factor); float ratio = (current_speed - max_speed_without_zipper) / max_increase_with_zipper; ratio = ratio > -0.12 ? ratio : -0.12; - float camera_distance = -5 * (1 + ratio);// distance of camera from kart in x and z plane - Vec3 camera_offset(camera_distance * sin(skid_angle / 2), 2 * (1 + ratio / 2),camera_distance * cos(skid_angle / 2));// defines how far camera should be from player kart. + float camera_distance = -3.5 * (1 + ratio);// distance of camera from kart in x and z plane + Vec3 camera_offset(camera_distance * sin(skid_angle / 2), 1.6 * (1 + ratio / 2),camera_distance * cos(skid_angle / 2));// defines how far camera should be from player kart. Vec3 m_kart_camera_position_with_offset = m_kart->getTrans()(camera_offset); @@ -337,9 +337,10 @@ void Camera::smoothMoveCamera(float dt) core::vector3df current_target = m_kart->getXYZ().toIrrVector();// next target core::vector3df wanted_position = m_kart_camera_position_with_offset.toIrrVector();// new required position of camera - current_position += ((wanted_position - current_position) * dt * (m_kart->getSpeed()>0 ? m_kart->getSpeed()/3 : -1 * m_kart->getSpeed() / 3) ); - - m_camera->setPosition(current_position); + current_position += ((wanted_position - current_position) * dt * (m_kart->getSpeed()>0 ? m_kart->getSpeed()/3 : -1 * m_kart->getSpeed() * 2 ) ); + + if(m_mode!=CM_FALLING) + m_camera->setPosition(current_position); m_camera->setTarget(current_target);//set new target assert(!isnan(m_camera->getPosition().X));