Camera even moved more closer

This commit is contained in:
Dk 2014-04-05 06:39:42 +05:30
parent 4b6ea54704
commit 746e23c0f1

View File

@ -287,7 +287,7 @@ void Camera::reset()
void Camera::setInitialTransform()
{
if (m_kart == NULL) return;
Vec3 start_offset(0, 1.6, -3.5);
Vec3 start_offset(0, 1.6, -3);
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,7 +328,7 @@ 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 = -3.5 * (1 + ratio);// distance of camera from kart in x and z plane
float camera_distance = -3 * (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,7 +337,7 @@ 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() * 2 ) );
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);