Moved steering adjustment when skidding into skidding class.
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@10949 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
2555cc6e59
commit
9d1e114bde
@ -1616,28 +1616,15 @@ void Kart::updatePhysics(float dt)
|
||||
|
||||
m_skidding->update(dt, isOnGround(), m_controls.m_steer,
|
||||
m_controls.m_skid);
|
||||
updateSliding();
|
||||
|
||||
float steering = getMaxSteerAngle() * m_controls.m_steer;
|
||||
// FIXME: Misuse (for now) the skid visual time to disable the new
|
||||
// skidding code
|
||||
if(m_kart_properties->getSkiddingProperties()->getSkidVisualTime()==0)
|
||||
{
|
||||
steering *= m_skidding->getSkidFactor();
|
||||
}
|
||||
else if(m_controls.m_skid)
|
||||
{
|
||||
steering *= m_kart_properties->getSkiddingProperties()
|
||||
->getSkidReduceTurnMin()
|
||||
* sqrt(m_kart_properties->getSkiddingProperties()->getMaxSkid()
|
||||
/ m_skidding->getSkidFactor());
|
||||
}
|
||||
else
|
||||
steering *= m_skidding->getSkidFactor();
|
||||
float steering = m_skidding->getSteering(m_controls.m_steer,
|
||||
getMaxSteerAngle());
|
||||
|
||||
m_vehicle->setSteeringValue(steering, 0);
|
||||
m_vehicle->setSteeringValue(steering, 1);
|
||||
|
||||
updateSliding();
|
||||
|
||||
// Only compute the current speed if this is not the client. On a client the
|
||||
// speed is actually received from the server.
|
||||
if(network_manager->getMode()!=NetworkManager::NW_CLIENT)
|
||||
|
@ -32,7 +32,7 @@ Skidding::Skidding(Kart *kart, const SkiddingProperties *sp)
|
||||
reset();
|
||||
} // Skidding
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// ----------------------------------------------------------------------------
|
||||
/** Resets all skidding related values.
|
||||
*/
|
||||
void Skidding::reset()
|
||||
@ -42,7 +42,25 @@ void Skidding::reset()
|
||||
m_skid_factor = 1.0f;
|
||||
} // reset
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// ----------------------------------------------------------------------------
|
||||
float Skidding::getSteering(float steer, float max_steer_angle)
|
||||
{
|
||||
float steering = steer * max_steer_angle;
|
||||
|
||||
switch(m_skid_state)
|
||||
{
|
||||
case SKID_NONE:
|
||||
case SKID_SHOW_GFX:
|
||||
case SKID_OLD: steering *= m_skid_factor;
|
||||
case SKID_ACCUMULATE_LEFT:
|
||||
case SKID_ACCUMULATE_RIGHT:
|
||||
steering *= m_skid_reduce_turn_min
|
||||
* sqrt(m_skid_max / m_skid_factor);
|
||||
} // switch m_skid_state
|
||||
return steering;
|
||||
} // getSteering
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
/** Updates skidding status.
|
||||
* \param dt Time step size.
|
||||
* \param is_on_ground True if the kart is on ground.
|
||||
|
@ -64,7 +64,7 @@ public:
|
||||
void update(float dt, bool is_on_ground, float steer,
|
||||
bool skidding);
|
||||
float getVisualSkidOffset() const;
|
||||
|
||||
float getSteering(float steer, float max_steer_angle);
|
||||
// ----------------------------------------------------------------------
|
||||
/** Returns the current skid factor in [1, skid_max_for_this_kart]. */
|
||||
float getSkidFactor() const { return m_skid_factor; }
|
||||
|
Loading…
Reference in New Issue
Block a user