Camera now points where the kart is turning based on steering angle and skidding amount, not on speed.
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/irrlicht@3469 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
d964805365
commit
a488b489ef
@ -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,8 +151,8 @@ 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));
|
||||
// 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();
|
||||
@ -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();
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user