Implemented CM_REVERSE camera mode for looking backwards.
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/irrlicht@3480 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
f4a76bc2ae
commit
2b3dc3c668
@ -166,6 +166,20 @@ void Camera::update(float dt)
|
||||
m_position *= m_distance;
|
||||
m_position += m_target;
|
||||
|
||||
break;
|
||||
case CM_REVERSE: // Same as CM_NORMAL except it looks backwards
|
||||
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);
|
||||
|
||||
m_position.setX(-sin(m_angle_around));
|
||||
m_position.setY( cos(m_angle_around));
|
||||
m_position.setZ( sin(m_angle_up));
|
||||
m_position *= m_distance * 2.0f;
|
||||
m_position += m_target;
|
||||
|
||||
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->getSkidding();
|
||||
@ -177,7 +191,7 @@ void Camera::update(float dt)
|
||||
m_position.setX( sin(m_angle_around));
|
||||
m_position.setY(-cos(m_angle_around));
|
||||
m_position.setZ(-sin(m_angle_up));
|
||||
m_position *= m_distance * 0.75f;
|
||||
m_position *= m_distance * 0.5f;
|
||||
m_position += m_target;
|
||||
|
||||
break;
|
||||
|
@ -36,7 +36,8 @@ class Camera
|
||||
public:
|
||||
enum Mode {
|
||||
CM_NORMAL, // Normal camera mode
|
||||
CM_CLOSEUP, // Normal camera, closer to kart
|
||||
CM_CLOSEUP, // Closer to kart
|
||||
CM_REVERSE, // Looking backwards
|
||||
CM_LEADER_MODE, // for deleted player karts in follow the leader
|
||||
CM_FINAL, // Final camera to show the end of the race
|
||||
CM_SIMPLE_REPLAY
|
||||
|
@ -256,6 +256,15 @@ void PlayerKart::update(float dt)
|
||||
Kart::beep();
|
||||
}
|
||||
|
||||
if(m_controls.m_look_back)
|
||||
{
|
||||
m_camera->setMode(Camera::CM_REVERSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_camera->setMode(Camera::CM_NORMAL);
|
||||
}
|
||||
|
||||
// We can't restrict rescue to fulfil isOnGround() (which would be more like
|
||||
// MK), since e.g. in the City track it is possible for the kart to end
|
||||
// up sitting on a brick wall, with all wheels in the air :((
|
||||
|
Loading…
Reference in New Issue
Block a user