Made the skidding parameters configurable in stk_config.data
(and on a per kart basis as well, so each kart can skid differently). git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@2676 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
5f0dd7ba4c
commit
28d119a9b0
@ -67,6 +67,15 @@
|
|||||||
|
|
||||||
(nitro-power-boost 3 ) ;; increase in engine power, i.e. 1=plus 100%
|
(nitro-power-boost 3 ) ;; increase in engine power, i.e. 1=plus 100%
|
||||||
|
|
||||||
|
;; Skidding related parameters:
|
||||||
|
(skid-increase 1.05) ;; Multiplicative increase of skidding factor
|
||||||
|
;; in each frame.
|
||||||
|
(skid-decrease 0.95) ;; Multiplicative decrease of skidding factor
|
||||||
|
;; in each frame.
|
||||||
|
(skid-max 2.0 ) ;; Maximum skidding factor = maximum increase
|
||||||
|
;; of steering angle.
|
||||||
|
(skid-visual 0.16) ;; Additional graphical rotation of kart.
|
||||||
|
|
||||||
;; Bullet physics attributes
|
;; Bullet physics attributes
|
||||||
(brake-factor 2.75 )
|
(brake-factor 2.75 )
|
||||||
;; Defines the smallest turn radius at lowest speed (4.64 m at
|
;; Defines the smallest turn radius at lowest speed (4.64 m at
|
||||||
|
@ -762,12 +762,13 @@ void Kart::updatePhysics (float dt)
|
|||||||
|
|
||||||
if(m_controls.jump)
|
if(m_controls.jump)
|
||||||
{
|
{
|
||||||
m_skidding*= 1.05f;
|
m_skidding*= m_kart_properties->getSkidIncrease();
|
||||||
if(m_skidding>2.0f) m_skidding=2.0f;
|
if(m_skidding>m_kart_properties->getMaxSkid())
|
||||||
|
m_skidding=m_kart_properties->getMaxSkid();
|
||||||
}
|
}
|
||||||
else if(m_skidding>1.0f)
|
else if(m_skidding>1.0f)
|
||||||
{
|
{
|
||||||
m_skidding *= 0.95f;
|
m_skidding *= m_kart_properties->getSkidDecrease();
|
||||||
if(m_skidding<1.0f) m_skidding=1.0f;
|
if(m_skidding<1.0f) m_skidding=1.0f;
|
||||||
}
|
}
|
||||||
if(m_skidding>1.0f)
|
if(m_skidding>1.0f)
|
||||||
@ -967,7 +968,8 @@ void Kart::updateGraphics(const Vec3& off_xyz, const Vec3& off_hpr)
|
|||||||
? getSpeed()*5.0f : 0);
|
? getSpeed()*5.0f : 0);
|
||||||
|
|
||||||
float speed_ratio = getSpeed()/getMaxSpeed();
|
float speed_ratio = getSpeed()/getMaxSpeed();
|
||||||
float offset_heading = getSteerPercent()*0.05f*3.1415926f * speed_ratio * m_skidding*m_skidding;
|
float offset_heading = getSteerPercent()*m_kart_properties->getSkidVisual()
|
||||||
|
* speed_ratio * m_skidding*m_skidding;
|
||||||
Moveable::updateGraphics(center_shift, Vec3(offset_heading, offset_pitch, 0));
|
Moveable::updateGraphics(center_shift, Vec3(offset_heading, offset_pitch, 0));
|
||||||
} // updateGraphics
|
} // updateGraphics
|
||||||
|
|
||||||
|
@ -70,6 +70,7 @@ KartProperties::KartProperties() : m_icon_material(0)
|
|||||||
m_max_speed_turn = m_angle_at_max =
|
m_max_speed_turn = m_angle_at_max =
|
||||||
m_rubber_band_max_length = m_rubber_band_force =
|
m_rubber_band_max_length = m_rubber_band_force =
|
||||||
m_rubber_band_duration =
|
m_rubber_band_duration =
|
||||||
|
m_skid_decrease = m_skid_increase = m_skid_visual = m_skid_max =
|
||||||
m_camera_max_accel = m_camera_max_brake =
|
m_camera_max_accel = m_camera_max_brake =
|
||||||
m_camera_distance = UNDEFINED;
|
m_camera_distance = UNDEFINED;
|
||||||
m_gravity_center_shift = Vec3(UNDEFINED);
|
m_gravity_center_shift = Vec3(UNDEFINED);
|
||||||
@ -250,6 +251,11 @@ void KartProperties::getAllData(const lisp::Lisp* lisp)
|
|||||||
lisp->get("rubber-band-force", m_rubber_band_force );
|
lisp->get("rubber-band-force", m_rubber_band_force );
|
||||||
lisp->get("rubber-band-duration", m_rubber_band_duration );
|
lisp->get("rubber-band-duration", m_rubber_band_duration );
|
||||||
|
|
||||||
|
lisp->get("skid-increase", m_skid_increase );
|
||||||
|
lisp->get("skid-decrease", m_skid_decrease );
|
||||||
|
lisp->get("skid-max", m_skid_max );
|
||||||
|
lisp->get("skid-visual", m_skid_visual );
|
||||||
|
|
||||||
lisp->getVector("groups", m_groups );
|
lisp->getVector("groups", m_groups );
|
||||||
|
|
||||||
// getVector appends to existing vectors, so a new one must be used to load
|
// getVector appends to existing vectors, so a new one must be used to load
|
||||||
@ -332,6 +338,11 @@ void KartProperties::checkAllSet(const std::string &filename)
|
|||||||
CHECK_NEG(m_rubber_band_max_length, "rubber-band-max-length" );
|
CHECK_NEG(m_rubber_band_max_length, "rubber-band-max-length" );
|
||||||
CHECK_NEG(m_rubber_band_force, "rubber-band-force" );
|
CHECK_NEG(m_rubber_band_force, "rubber-band-force" );
|
||||||
CHECK_NEG(m_rubber_band_duration, "rubber-band-duration" );
|
CHECK_NEG(m_rubber_band_duration, "rubber-band-duration" );
|
||||||
|
CHECK_NEG(m_skid_decrease, "skid-decrease" );
|
||||||
|
CHECK_NEG(m_skid_increase, "skid-increase" );
|
||||||
|
CHECK_NEG(m_skid_max, "skid-max" );
|
||||||
|
CHECK_NEG(m_skid_visual, "skid-visual" );
|
||||||
|
|
||||||
CHECK_NEG(m_camera_max_accel, "camera-max-accel" );
|
CHECK_NEG(m_camera_max_accel, "camera-max-accel" );
|
||||||
CHECK_NEG(m_camera_max_brake, "camera-max-brake" );
|
CHECK_NEG(m_camera_max_brake, "camera-max-brake" );
|
||||||
CHECK_NEG(m_camera_distance, "camera-distance" );
|
CHECK_NEG(m_camera_distance, "camera-distance" );
|
||||||
|
@ -127,6 +127,15 @@ protected:
|
|||||||
float m_upright_tolerance;
|
float m_upright_tolerance;
|
||||||
float m_upright_max_force;
|
float m_upright_max_force;
|
||||||
|
|
||||||
|
float m_skid_visual; /**< Additional rotation of 3d model
|
||||||
|
* when skidding. */
|
||||||
|
float m_skid_max; /**< Maximal increase of steering when
|
||||||
|
* skidding. */
|
||||||
|
float m_skid_increase; /**< Skidding is multiplied by this when
|
||||||
|
* skidding to increase to
|
||||||
|
* m_skid_increase. */
|
||||||
|
float m_skid_decrease; /**< Skidding is multiplied by this when
|
||||||
|
* not skidding to decrease to 1.0. */
|
||||||
// Camera related setting
|
// Camera related setting
|
||||||
// ----------------------
|
// ----------------------
|
||||||
float m_camera_max_accel; // maximum acceleration of camera
|
float m_camera_max_accel; // maximum acceleration of camera
|
||||||
@ -199,6 +208,16 @@ public:
|
|||||||
float getRubberBandForce () const {return m_rubber_band_force; }
|
float getRubberBandForce () const {return m_rubber_band_force; }
|
||||||
/** Returns the duration a rubber band is active for. */
|
/** Returns the duration a rubber band is active for. */
|
||||||
float getRubberBandDuration () const {return m_rubber_band_duration; }
|
float getRubberBandDuration () const {return m_rubber_band_duration; }
|
||||||
|
/** Returns additional rotation of 3d model when skidding. */
|
||||||
|
float getSkidVisual () const {return m_skid_visual; }
|
||||||
|
/** Returns the maximum factor by which the steering angle can be increased. */
|
||||||
|
float getMaxSkid () const {return m_skid_max; }
|
||||||
|
/** Returns the factor by which m_skidding is multiplied when the kart is
|
||||||
|
* skidding to increase it to the maximum. */
|
||||||
|
float getSkidIncrease () const {return m_skid_increase; }
|
||||||
|
/** Returns the factor by which m_skidding is multiplied when the kart is
|
||||||
|
* not skidding to decrease it back to 1.0f . */
|
||||||
|
float getSkidDecrease () const {return m_skid_decrease; }
|
||||||
const std::vector<float>&
|
const std::vector<float>&
|
||||||
getGearSwitchRatio () const {return m_gear_switch_ratio; }
|
getGearSwitchRatio () const {return m_gear_switch_ratio; }
|
||||||
const std::vector<float>&
|
const std::vector<float>&
|
||||||
|
Loading…
x
Reference in New Issue
Block a user