Camera while moving back is fixed
This commit is contained in:
parent
18335676e4
commit
ff2f3c0896
@ -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,8 +337,9 @@ 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) );
|
||||
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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user