Made initial skidding jump graphical only (both options can
be set in stk_config now). git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@11576 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
@@ -185,6 +185,9 @@
|
||||
the chassis of a kart should rotate to match the graphical view.
|
||||
A factor of 1 is identical, a smaller factor will rotate the kart
|
||||
less (which might feel better).
|
||||
physical-jump-time: Time for a physical jump at the beginning of a skid.
|
||||
graphical-jump-time: Time for a graphics-only jump at the beginning
|
||||
of a skid.
|
||||
reduce-turn-min/max: The steering done by the controller (which is in
|
||||
[-1,1]) is mapped to [reduce-turn-min, reduce-turn-max] when skidding
|
||||
is active (for left turn, right turn will use [-max, -min]). The
|
||||
@@ -197,7 +200,8 @@
|
||||
time-till-bonus="1.0 3.0"
|
||||
bonus-speed="4.5 6.5" bonus-time="3.0 4.0"
|
||||
bonus-force="250 350"
|
||||
post-skid-rotate-factor="1" jump-time="0.4"
|
||||
physical-jump-time="0" graphical-jump-time="0.4"
|
||||
post-skid-rotate-factor="1"
|
||||
reduce-turn-min="0.2" reduce-turn-max="0.8"/>
|
||||
|
||||
<!-- Kart-specific settings used by the AI.
|
||||
|
||||
@@ -2208,6 +2208,7 @@ void Kart::updateGraphics(float dt, const Vec3& offset_xyz,
|
||||
- m_vehicle->getWheelInfo(0).m_wheelsRadius
|
||||
- (m_kart_model->getWheelGraphicsRadius(0)
|
||||
-m_kart_model->getWheelGraphicsPosition(0).getY() );
|
||||
y += m_skidding->getGraphicalJumpOffset();
|
||||
center_shift.setY(y);
|
||||
|
||||
if (m_controls.m_nitro && isOnGround() && m_collected_energy > 0)
|
||||
|
||||
@@ -62,12 +62,15 @@ Skidding::~Skidding()
|
||||
*/
|
||||
void Skidding::reset()
|
||||
{
|
||||
m_skid_time = 0.0f;
|
||||
m_skid_state = m_skid_visual_time<=0 ? SKID_OLD : SKID_NONE;
|
||||
m_skid_factor = 1.0f;
|
||||
m_real_steering = 0.0f;
|
||||
m_visual_rotation = 0.0f;
|
||||
m_skid_bonus_ready = false;
|
||||
m_skid_time = 0.0f;
|
||||
m_skid_state = m_skid_visual_time<=0 ? SKID_OLD : SKID_NONE;
|
||||
m_skid_factor = 1.0f;
|
||||
m_real_steering = 0.0f;
|
||||
m_visual_rotation = 0.0f;
|
||||
m_skid_bonus_ready = false;
|
||||
m_gfx_jump_offset = 0.0f;
|
||||
m_remaining_jump_time = 0.0f;
|
||||
m_jump_speed = 0.0f;
|
||||
} // reset
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -194,6 +197,20 @@ void Skidding::update(float dt, bool is_on_ground,
|
||||
if(m_skid_state == SKID_OLD)
|
||||
return;
|
||||
|
||||
// If skidding was started and a graphical jump should still
|
||||
// be displayed, update the data
|
||||
if(m_remaining_jump_time>0)
|
||||
{
|
||||
m_jump_speed -= World::getWorld()->getTrack()->getGravity()*dt;
|
||||
m_gfx_jump_offset += m_jump_speed * dt;
|
||||
m_remaining_jump_time -= dt;
|
||||
if(m_remaining_jump_time<0)
|
||||
{
|
||||
m_remaining_jump_time = 0.0f;
|
||||
m_gfx_jump_offset = 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
// This is only reached if the new skidding is enabled
|
||||
// ---------------------------------------------------
|
||||
|
||||
@@ -242,10 +259,15 @@ void Skidding::update(float dt, bool is_on_ground,
|
||||
// Then use this speed to determine the impulse necessary to
|
||||
// reach this speed.
|
||||
float v = World::getWorld()->getTrack()->getGravity()
|
||||
* 0.5f*m_jump_time;
|
||||
* 0.5f*m_physical_jump_time;
|
||||
btVector3 imp(0, v / m_kart->getBody()->getInvMass(),0);
|
||||
m_kart->getVehicle()->getRigidBody()->applyCentralImpulse(imp);
|
||||
|
||||
// Some karts might use a graphical-only jump. Set it up:
|
||||
m_jump_speed = World::getWorld()->getTrack()->getGravity()
|
||||
* 0.5f*m_graphical_jump_time;
|
||||
m_remaining_jump_time = m_graphical_jump_time;
|
||||
|
||||
#ifdef SKID_DEBUG
|
||||
#define SPEED 20.0f
|
||||
updateSteering(steering);
|
||||
|
||||
@@ -61,6 +61,17 @@ private:
|
||||
* stopped skidding now. */
|
||||
bool m_skid_bonus_ready;
|
||||
|
||||
/** Set to >0 when a graphical jump is to be done. */
|
||||
float m_remaining_jump_time;
|
||||
|
||||
/** A vertical offset used to make the kart do a graphical 'jump' when
|
||||
* skidding is started. */
|
||||
float m_gfx_jump_offset;
|
||||
|
||||
/** Keeps track of a graphical jump speed (which simulates the physics,
|
||||
* i.e. gravity is used to reduce the jump speed. */
|
||||
float m_jump_speed;
|
||||
|
||||
public:
|
||||
/** SKID_OLD: old skidding, will be removed. */
|
||||
/** SKID_NONE: Kart is currently not skidding.
|
||||
@@ -111,11 +122,13 @@ public:
|
||||
* a fraction of the maximum steering angle ( so in [-1, 1]). */
|
||||
float getSteeringFraction() { return m_real_steering; }
|
||||
// ------------------------------------------------------------------------
|
||||
float getGraphicalJumpOffset() { return m_gfx_jump_offset; }
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns the skidding state. */
|
||||
SkidState getSkidState() const { return m_skid_state; }
|
||||
protected:
|
||||
// The AI needs more details about the skidding state
|
||||
friend class SkiddingAI;
|
||||
/** Returns the skidding state. */
|
||||
SkidState getSkidState() const { return m_skid_state; }
|
||||
// ------------------------------------------------------------------------
|
||||
float getSteeringWhenSkidding(float steering) const;
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
@@ -35,7 +35,8 @@ SkiddingProperties::SkiddingProperties()
|
||||
m_post_skid_rotate_factor = UNDEFINED;
|
||||
m_skid_reduce_turn_min = UNDEFINED;
|
||||
m_skid_reduce_turn_max = UNDEFINED;
|
||||
m_jump_time = UNDEFINED;
|
||||
m_physical_jump_time = UNDEFINED;
|
||||
m_graphical_jump_time = UNDEFINED;
|
||||
m_has_skidmarks = true;
|
||||
|
||||
m_skid_bonus_time.clear();
|
||||
@@ -61,7 +62,8 @@ void SkiddingProperties::load(const XMLNode *skid_node)
|
||||
skid_node->get("bonus-speed", &m_skid_bonus_speed );
|
||||
skid_node->get("time-till-bonus", &m_skid_time_till_bonus );
|
||||
skid_node->get("bonus-force", &m_skid_bonus_force );
|
||||
skid_node->get("jump-time", &m_jump_time );
|
||||
skid_node->get("physical-jump-time", &m_physical_jump_time );
|
||||
skid_node->get("graphical-jump-time", &m_graphical_jump_time );
|
||||
} // load
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -80,7 +82,8 @@ void SkiddingProperties::checkAllSet(const std::string &filename) const
|
||||
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" );
|
||||
CHECK_NEG(m_jump_time, "skid jump-time" );
|
||||
CHECK_NEG(m_physical_jump_time, "skid physical-jump-time" );
|
||||
CHECK_NEG(m_graphical_jump_time, "skid graphical-jump-time" );
|
||||
|
||||
if(m_skid_time_till_bonus.size()==0)
|
||||
fprintf(stderr, "Warning: no skid time declared, can be ignored.\n");
|
||||
|
||||
@@ -59,8 +59,11 @@ protected:
|
||||
/** Additional rotation of 3d model when skidding. */
|
||||
float m_skid_visual;
|
||||
|
||||
/** Time for a small jump when skidding starts. */
|
||||
float m_jump_time;
|
||||
/** Time for a small physical when skidding starts. */
|
||||
float m_physical_jump_time;
|
||||
|
||||
/** Time for a small graphics-only jump when skidding starts. */
|
||||
float m_graphical_jump_time;
|
||||
|
||||
/** This factor is used to determine how much the chassis of a kart
|
||||
* should rotate to match the graphical view. A factor of 1 is
|
||||
|
||||
Reference in New Issue
Block a user