diff --git a/src/graphics/camera.cpp b/src/graphics/camera.cpp index 4c46f8900..6621becad 100644 --- a/src/graphics/camera.cpp +++ b/src/graphics/camera.cpp @@ -35,16 +35,19 @@ Camera::Camera(int camera_index, const Kart* kart) m_mode = CM_NORMAL; m_index = camera_index; m_camera = irr_driver->addCamera(); - m_distance = kart->getKartProperties()->getCameraDistance() * 0.75f; + m_distance = kart->getKartProperties()->getCameraDistance() * 0.5f; m_kart = kart; m_angle_up = 0.0f; m_angle_around = 0.0f; // TODO: Put these values into a config file // Global or per split screen zone? + // Either global or per user (for instance, some users may not like + // the extra camera rotation so they could set m_rotation_range to + // zero to disable it for themselves). m_position_speed = 8.0f; m_target_speed = 10.0f; - m_rotation_range = 1.0f; + m_rotation_range = 0.4f; // TODO: Set fog distance and clipping planes setScreenPosition(camera_index); @@ -148,9 +151,9 @@ void Camera::update(float dt) { case CM_NORMAL: // This first line moves the camera around behind the kart, pointing it - // towards where the kart is turning (but only at lower speeds). - m_angle_around = m_kart->getHPR().getX() + m_rotation_range * (m_kart->getSteerPercent() / (m_kart->getSpeed() * 0.1f + 1)); - m_angle_up = m_kart->getHPR().getY() - DEGREE_TO_RAD(30.0f); + // towards where the kart is turning (and turning even more while skidding). + m_angle_around = m_kart->getHPR().getX() + m_rotation_range * m_kart->getSteerPercent() * m_kart->getSkidding(); + m_angle_up = m_kart->getHPR().getY() - DEGREE_TO_RAD(30.0f); m_target = m_kart->getXYZ(); m_target.setZ(m_target.getZ()+0.75f); @@ -163,7 +166,7 @@ void Camera::update(float dt) break; case CM_CLOSEUP: // Lower to the ground and closer to the kart - m_angle_around = m_kart->getHPR().getX() + m_rotation_range * (m_kart->getSteerPercent() / (m_kart->getSpeed() * 0.1f + 1)); + m_angle_around = m_kart->getHPR().getX() + m_rotation_range * m_kart->getSteerPercent() * m_kart->getSkidding(); m_angle_up = m_kart->getHPR().getY() - DEGREE_TO_RAD(20.0f); m_target = m_kart->getXYZ(); diff --git a/src/karts/kart.hpp b/src/karts/kart.hpp index 92a34a38f..e5d83d31e 100644 --- a/src/karts/kart.hpp +++ b/src/karts/kart.hpp @@ -204,6 +204,7 @@ public: float getTimeFullSteer () const {return m_kart_properties->getTimeFullSteer();} float getBrakeFactor () const {return m_kart_properties->getBrakeFactor();} float getFrictionSlip () const {return m_kart_properties->getFrictionSlip();} + float getSkidding () const {return m_skidding;} float getMaxSteerAngle () const {return m_kart_properties->getMaxSteerAngle(getSpeed());} const Vec3& getGravityCenterShift () const