Made steering for keyboards less sensitive (or slower)
at smaller steering angles, and a bit more fast at higher steering angles (resulting in overall the same time-till-full steer). git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@11951 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
7921acc4aa
commit
3b4c5f3bbb
@ -366,11 +366,20 @@
|
||||
allows for tighter turning at lower speeds, and also avoids that
|
||||
the kart becomes too hard to control at high speed (speeds of higher
|
||||
than 23 can only be reached with powerups).
|
||||
time-full-steer is the time when a player's input goes from neutral
|
||||
steering to extreme left or right.
|
||||
time-full-steer: This is the amount of change in steering depending
|
||||
on current steering. So if the steering is between 0 and 0.5,
|
||||
the time-for-steering-change is 0.25. If the current steering is
|
||||
between 0.5 and 1.0, the time-for-steering-change is 0.15.
|
||||
The speed is used as dt/time-for-steering-change.
|
||||
In short: steering at less than halfway is somewhat slower,
|
||||
making it easier with a keyboard to get minor changes, but
|
||||
faster when you want to steer more. Overwall with the current
|
||||
settings the expected time-to-full-steer is:
|
||||
0.5 * 0.25 + 0.5 * 0.15 = 0.2 ... which is overall the same
|
||||
time we had previously.
|
||||
-->
|
||||
<turn turn-radius="0:2.0 10:7.5 25:15 45:25"
|
||||
time-full-steer ="0.2"
|
||||
time-full-steer ="0:0.25 0.5:0.25 0.5:0.15 1.0:0.15"
|
||||
time-reset-steer="0.1" />
|
||||
|
||||
<!-- Speed and acceleration related values: power and max-speed (in m/s)
|
||||
|
@ -117,8 +117,10 @@ public:
|
||||
* speed. */
|
||||
virtual float getMaxSteerAngle () const = 0;
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns the time till full steering is reached for this kart. */
|
||||
virtual float getTimeFullSteer() const = 0;
|
||||
/** Returns the time till full steering is reached for this kart.
|
||||
* This can depend on the current steering value, which must be >= 0.
|
||||
*/
|
||||
virtual float getTimeFullSteer(float steer) const = 0;
|
||||
|
||||
// ========================================================================
|
||||
// Attachment related functions.
|
||||
|
@ -252,8 +252,8 @@ void PlayerController::steer(float dt, int steer_val)
|
||||
// change speed is used.
|
||||
const float STEER_CHANGE = (steer_val<=0 && m_controls->m_steer<0 ||
|
||||
steer_val>=0 && m_controls->m_steer>0 )
|
||||
? dt/m_kart->getKartProperties()->getTimeResetSteer()
|
||||
: dt/m_kart->getTimeFullSteer();
|
||||
? dt/m_kart->getKartProperties()->getTimeResetSteer()
|
||||
: dt/m_kart->getTimeFullSteer(fabsf(m_controls->m_steer));
|
||||
if (steer_val < 0)
|
||||
{
|
||||
// If we got analog values do not cumulate.
|
||||
|
@ -337,9 +337,13 @@ public:
|
||||
const video::SColor &getColor() const
|
||||
{return m_kart_properties->getColor();}
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns the time till full steering is reached for this kart. */
|
||||
virtual float getTimeFullSteer() const
|
||||
{ return m_kart_properties->getTimeFullSteer(); }
|
||||
/** Returns the time till full steering is reached for this kart.
|
||||
* \param steer Current steer value (must be >=0), on which the time till
|
||||
* full steer depends. */
|
||||
virtual float getTimeFullSteer(float steer) const
|
||||
{
|
||||
return m_kart_properties->getTimeFullSteer(steer);
|
||||
} // getTimeFullSteer
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns the maximum steering angle for this kart, which depends on the
|
||||
* speed. */
|
||||
|
@ -62,8 +62,7 @@ KartProperties::KartProperties(const std::string &filename)
|
||||
// if everything is defined properly.
|
||||
m_mass = m_brake_factor = m_engine_power[0] = m_engine_power[1] =
|
||||
m_engine_power[2] = m_max_speed[0] = m_max_speed[1] = m_max_speed[2] =
|
||||
m_time_full_steer = m_time_reset_steer =
|
||||
m_nitro_consumption = m_nitro_engine_force =
|
||||
m_time_reset_steer = m_nitro_consumption = m_nitro_engine_force =
|
||||
m_nitro_small_container = m_nitro_big_container = m_nitro_max =
|
||||
m_nitro_max_speed_increase = m_nitro_duration = m_nitro_fade_out_time =
|
||||
m_suspension_stiffness = m_wheel_damping_relaxation = m_wheel_base =
|
||||
@ -601,7 +600,6 @@ void KartProperties::checkAllSet(const std::string &filename)
|
||||
}
|
||||
|
||||
CHECK_NEG(m_mass, "mass" );
|
||||
CHECK_NEG(m_time_full_steer, "turn time-full-steer" );
|
||||
CHECK_NEG(m_time_reset_steer, "turn time-reset-steer" );
|
||||
CHECK_NEG(m_wheel_damping_relaxation, "wheels damping-relaxation" );
|
||||
CHECK_NEG(m_wheel_damping_compression, "wheels damping-compression" );
|
||||
|
@ -119,20 +119,25 @@ private:
|
||||
* drawing the dot on the mini map. */
|
||||
// Physic properties
|
||||
// -----------------
|
||||
float m_mass; /**< Weight of kart. */
|
||||
float m_engine_power[3]; /**< Maximum force from engine for each
|
||||
* difficulty. */
|
||||
float m_brake_factor; /**< Braking factor * engine_power =
|
||||
* braking force. */
|
||||
float m_time_full_steer; /**< Time for player karts to reach full
|
||||
* steer angle. */
|
||||
float m_time_reset_steer; /**< Time for steering to go back to
|
||||
zero from full steer. */
|
||||
/** Weight of kart. */
|
||||
float m_mass;
|
||||
|
||||
/** Maximum force from engine for eachdifficulty. */
|
||||
float m_engine_power[3];
|
||||
|
||||
/** Braking factor * engine_power braking force. */
|
||||
float m_brake_factor;
|
||||
|
||||
/** Time for player karts to reach full steer angle. */
|
||||
InterpolationArray m_time_full_steer;
|
||||
|
||||
/** Time for steering to go back to zero from full steer. */
|
||||
float m_time_reset_steer;
|
||||
|
||||
/** The turn angle depending on speed. */
|
||||
InterpolationArray m_turn_angle_at_speed;
|
||||
|
||||
/** If != 0 a bevelled box shape is used by using a point cloud as a
|
||||
/** If != 0 a bevelled box shape is used by using a point cloud as a
|
||||
* collision shape. */
|
||||
Vec3 m_bevel_factor;
|
||||
|
||||
@ -421,8 +426,13 @@ public:
|
||||
{return m_engine_power[race_manager->getDifficulty()];}
|
||||
|
||||
/** Returns the time the kart needs to fully steer in one direction from
|
||||
* steering straight. */
|
||||
float getTimeFullSteer () const {return m_time_full_steer; }
|
||||
* steering straight depending on the current steering value.
|
||||
* \param steer Current steering value, must be >=0. */
|
||||
float getTimeFullSteer(float steer) const
|
||||
{
|
||||
assert(steer>=0);
|
||||
return m_time_full_steer.get(steer);
|
||||
} // getTimeFullSteer
|
||||
|
||||
/** Returns the time the kart needs to go back to steering straight from
|
||||
* full steer. */
|
||||
|
@ -56,8 +56,14 @@ public:
|
||||
if(m_y.size()>1)
|
||||
{
|
||||
const unsigned int last=m_x.size()-1;
|
||||
m_delta.push_back( (m_y[last]-m_y[last-1])
|
||||
/(m_x[last]-m_x[last-1]) );
|
||||
// Avoid division by zero, just set m_delta to a large
|
||||
// value with the right sign
|
||||
if(m_x[last]==m_x[last-1])
|
||||
m_delta.push_back( (m_y[last]-m_y[last-1])
|
||||
/ 0.001f );
|
||||
else
|
||||
m_delta.push_back( (m_y[last]-m_y[last-1])
|
||||
/(m_x[last]-m_x[last-1]) );
|
||||
}
|
||||
return 1;
|
||||
} // push_back
|
||||
|
Loading…
x
Reference in New Issue
Block a user