From d25ea996659f1ba00721ef43d7d9b3e26a0a7279 Mon Sep 17 00:00:00 2001 From: Dk Date: Wed, 9 Apr 2014 22:24:32 +0530 Subject: [PATCH] Revert "Camera After Rescue comes to normal quickly" This reverts commit 0345f26a7bab3623c88301caaeff4f6c5de1fedc. git commit -m "revert" --- src/graphics/camera.cpp | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/graphics/camera.cpp b/src/graphics/camera.cpp index e961872a0..fbdd1d4f6 100644 --- a/src/graphics/camera.cpp +++ b/src/graphics/camera.cpp @@ -234,12 +234,17 @@ void Camera::setMode(Mode mode) { // If we switch from reverse view, move the camera immediately to the // correct position. - if((m_mode==CM_REVERSE && mode==CM_NORMAL) || (m_mode==CM_FALLING && mode==CM_NORMAL)) + if(m_mode==CM_REVERSE && mode==CM_NORMAL) { - Vec3 start_offset(0, 1.6, -3); - Vec3 current_position = m_kart->getTrans()(start_offset); - m_camera->setPosition( current_position.toIrrVector()); - m_camera->setTarget(m_camera->getPosition()); + Vec3 wanted_position, wanted_target; + computeNormalCameraPosition(&wanted_position, &wanted_target); + m_camera->setPosition(wanted_position.toIrrVector()); + m_camera->setTarget(wanted_target.toIrrVector()); + + assert(!isnan(m_camera->getPosition().X)); + assert(!isnan(m_camera->getPosition().Y)); + assert(!isnan(m_camera->getPosition().Z)); + } if(mode==CM_FINAL) { @@ -283,8 +288,8 @@ void Camera::setInitialTransform() { if (m_kart == NULL) return; Vec3 start_offset(0, 1.6, -3); - Vec3 current_position = m_kart->getTrans()(start_offset); - m_camera->setPosition( current_position.toIrrVector()); + Vec3 xx = m_kart->getTrans()(start_offset); + m_camera->setPosition( xx.toIrrVector()); // Reset the target from the previous target (in case of a restart // of a race) - otherwise the camera will initially point in the wrong // direction till smoothMoveCamera has corrected this. Setting target @@ -316,6 +321,7 @@ void Camera::smoothMoveCamera(float dt) float max_speed_without_zipper = kp->getMaxSpeed(); float current_speed = m_kart->getSpeed(); + float steer = m_kart->getSteerPercent(); const Skidding *ks = m_kart->getSkidding(); float skid_factor = ks->getVisualSkidRotation(); @@ -331,14 +337,8 @@ 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 - if ((m_kart->getSpeed() > 5 ) || (m_kart->getSpeed() < 0 )) - { - current_position += ((wanted_position - current_position) * dt * (m_kart->getSpeed()>0 ? m_kart->getSpeed()/3 + 1.0f : -1 * m_kart->getSpeed() * 1.5 + 2.0f)); - } - else - { - current_position += (wanted_position - current_position) * dt * 5; - } + current_position += ((wanted_position - current_position) * dt * (m_kart->getSpeed()>0 ? m_kart->getSpeed()/3 : -1 * m_kart->getSpeed() * 1.5 ) ); + if(m_mode!=CM_FALLING) m_camera->setPosition(current_position); m_camera->setTarget(current_target);//set new target