Made the time for the physical body to be in sync with the

graphics after a skid configurable - though atm this is still
set to the same time, so no noticable difference.


git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@11620 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk
2012-09-20 23:06:19 +00:00
parent eb44d3d9c5
commit 9b51751e31
5 changed files with 26 additions and 12 deletions

View File

@@ -182,6 +182,8 @@
of the kart also determines the direction the kart is driving to
when skidding is stopped.
visual-time: How long it takes for the visual skid to reach maximum.
revert-visual-time: how long it takes when stopping a skid to revert
the visual skid and bring visuals and physics in sync again.
angular-velocity: Angular velocity to be used for the kart when skidding.
time-till-bonus: How long a kart needs to skid in order to get a bonus.
bonus-force: A speedup applied to the kart whick skidded for a while.
@@ -204,7 +206,7 @@
but you will always keep on doing a left turn, just more or less. -->
<skid increase="1.05" decrease="0.95" max="2.5" time-till-max="0.5"
visual="1.25" visual-time="0.7"
visual="1.25" visual-time="0.7" revert-visual-time="0.7"
time-till-bonus="1.0 3.0"
bonus-speed="4.5 6.5" bonus-time="3.0 4.0"
bonus-force="250 350"

View File

@@ -126,12 +126,14 @@ void Skidding::updateSteering(float steer)
} // updateSteering
// ----------------------------------------------------------------------------
/** Returns the steering value necessary to steer the specified amount in
* 'steering'. If the kart is not skidding, the return value is just
* steering. Otherwise the value will be (depending on current skidding
* direction) adjusted to a value 'steering1', so that when the kart
* steers 'steering1', it will de facto steer by the original steering
* amount. If it's not possible
/** Returns the steering value necessary to set in KartControls.m_steer in
* order to actually to steer the specified amount in 'steering'.
* If the kart is not skidding, the return value is just
* 'steering'. Otherwise the return value will be (depending on current
* skidding direction) 'steering1', so that when the kart
* steers 'steering1', it will de facto steer by the original 'steering'
* amount. This function might return a result outside of [-1,1] if the
* specified steering can not be reached (e.g. due to skidding)
*/
float Skidding::getSteeringWhenSkidding(float steering) const
{
@@ -194,10 +196,12 @@ void Skidding::update(float dt, bool is_on_ground,
else
if(m_skid_factor<1.0f) m_skid_factor = 1.0f;
updateSteering(steering);
// FIXME hiker: remove once the new skidding code is finished.
if(m_skid_state == SKID_OLD)
{
updateSteering(steering);
return;
}
// If skidding was started and a graphical jump should still
// be displayed, update the data
@@ -336,6 +340,9 @@ void Skidding::update(float dt, bool is_on_ground,
float t = (m_skid_time <= m_skid_visual_time)
? m_skid_time
: m_skid_visual_time;
if(t>m_skid_revert_visual_time)
t = m_skid_revert_visual_time;
float vso = getVisualSkidRotation();
btVector3 rot(0, vso*m_post_skid_rotate_factor, 0);
m_kart->getVehicle()->setTimedRotation(t, rot);
@@ -360,7 +367,7 @@ void Skidding::update(float dt, bool is_on_ground,
case SKID_SHOW_GFX_LEFT:
case SKID_SHOW_GFX_RIGHT:
m_skid_time -= dt;
if(m_skid_time<=0)
if(m_skid_time<=0)
{
m_skid_time = 0;
m_kart->getKartGFX()
@@ -368,6 +375,7 @@ void Skidding::update(float dt, bool is_on_ground,
m_skid_state = SKID_NONE;
}
} // switch
updateSteering(steering);
} // update
// ----------------------------------------------------------------------------

View File

@@ -131,9 +131,6 @@ public:
// ------------------------------------------------------------------------
/** Returns the skidding state. */
SkidState getSkidState() const { return m_skid_state; }
protected:
// The AI needs more details about the skidding state
friend class SkiddingAI;
// ------------------------------------------------------------------------
float getSteeringWhenSkidding(float steering) const;
// ------------------------------------------------------------------------

View File

@@ -32,6 +32,7 @@ SkiddingProperties::SkiddingProperties()
m_time_till_max_skid = UNDEFINED;
m_skid_visual = UNDEFINED;
m_skid_visual_time = UNDEFINED;
m_skid_revert_visual_time = UNDEFINED;
m_post_skid_rotate_factor = UNDEFINED;
m_skid_reduce_turn_min = UNDEFINED;
m_skid_reduce_turn_max = UNDEFINED;
@@ -54,6 +55,7 @@ void SkiddingProperties::load(const XMLNode *skid_node)
skid_node->get("time-till-max", &m_time_till_max_skid );
skid_node->get("visual", &m_skid_visual );
skid_node->get("visual-time", &m_skid_visual_time );
skid_node->get("revert-visual-time", &m_skid_revert_visual_time);
skid_node->get("post-skid-rotate-factor",&m_post_skid_rotate_factor);
skid_node->get("reduce-turn-min", &m_skid_reduce_turn_min );
skid_node->get("reduce-turn-max", &m_skid_reduce_turn_max );
@@ -79,6 +81,7 @@ void SkiddingProperties::checkAllSet(const std::string &filename) const
CHECK_NEG(m_time_till_max_skid, "skid time-till-max" );
CHECK_NEG(m_skid_visual, "skid visual" );
CHECK_NEG(m_skid_visual_time, "skid visual-time" );
CHECK_NEG(m_skid_revert_visual_time, "skid revert-visual-time" );
CHECK_NEG(m_post_skid_rotate_factor, "skid post-skid-rotate-factor" );
CHECK_NEG(m_skid_reduce_turn_min, "skid reduce-turn-min" );
CHECK_NEG(m_skid_reduce_turn_max, "skid reduce-turn-max" );

View File

@@ -50,6 +50,10 @@ protected:
/** How long it takes for visual skid to reach maximum. */
float m_skid_visual_time;
/** How long it takes for the physical and graphical bodies to be
* in sync again after a skid. */
float m_skid_revert_visual_time;
/** Time till maximum skidding is reached. */
float m_time_till_max_skid;