Bullet only: made the bullet jump velocity configurable.

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@1292 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk 2007-11-18 13:44:53 +00:00
parent aeb5860be8
commit 1da4736435
5 changed files with 14 additions and 2 deletions

View File

@ -82,6 +82,13 @@
(gravity-center-shift 0.4 ) ;; Shift center of gravity down by that many
;; units of kart_height (usually between 0 and 0.5)
(suspension-rest 0.1 )
;; The z-axis velocity set when a jump is initiated. This will cause the
;; kart to start rising, till it is pulled back by gravity. A higher value
;; means higher Z velocity, meaning the kart will rise faster and higher,
;; and will be in the air longer
(jump-velocity 3.0 )
;; The following two vectors define at what ratio of the maximum speed what
;; gear is selected, e.g. 0.25 means: if speed <=0.25*maxSpeed --> gear 1,
;; 0.5 means: if speed <=0.5 *maxSpeed --> gear 2

View File

@ -972,7 +972,7 @@ void Kart::updatePhysics (float dt)
//Vector3 impulse(0.0f, 0.0f, 10.0f);
// getVehicle()->getRigidBody()->applyCentralImpulse(impulse);
btVector3 velocity = m_body->getLinearVelocity();
velocity.setZ( 3.0f );
velocity.setZ( m_kart_properties->getJumpVelocity() );
getBody()->setLinearVelocity( velocity );

View File

@ -161,6 +161,7 @@ void KartProperties::getAllData(const lisp::Lisp* lisp)
lisp->get("maximum-speed", m_maximum_speed );
lisp->get("gravity-center-shift", m_gravity_center_shift );
lisp->get("suspension-rest", m_suspension_rest );
lisp->get("jump-velocity", m_jump_velocity );
#ifdef BULLET
// getVector appends to existing vectors, so a new one must be used to load
std::vector<float> temp;
@ -225,6 +226,7 @@ void KartProperties::init_defaults()
m_max_speed_reverse_ratio = stk_config->m_max_speed_reverse_ratio;
m_gravity_center_shift = stk_config->m_gravity_center_shift;
m_suspension_rest = stk_config->m_suspension_rest;
m_jump_velocity = stk_config->m_jump_velocity;
m_gear_switch_ratio = stk_config->m_gear_switch_ratio;
m_gear_power_increase = stk_config->m_gear_power_increase;

View File

@ -90,6 +90,7 @@ protected:
float m_max_speed_reverse_ratio;
float m_gravity_center_shift;
float m_suspension_rest;
float m_jump_velocity; // z velocity set when jumping
// The following two vectors define at what ratio of the maximum speed what
// gear is selected, e.g. 0.25 means: if speed <=0.25*maxSpeed --> gear 1,
// 0.5 means: if speed <=0.5 *maxSpeed --> gear 2
@ -156,6 +157,7 @@ public:
float getMaximumSpeed () const {return m_maximum_speed; }
float getGravityCenterShift () const {return m_gravity_center_shift; }
float getSuspensionRest () const {return m_suspension_rest; }
float getJumpVelocity () const {return m_jump_velocity; }
const std::vector<float>&
getGearSwitchRatio () const {return m_gear_switch_ratio; }
const std::vector<float>&

View File

@ -111,6 +111,7 @@ void STKConfig::load(const std::string filename)
CHECK_NEG(m_max_road_distance, "shortcut-road-distance" );
CHECK_NEG(m_shortcut_segments, "shortcut-skipped-segments" );
CHECK_NEG(m_suspension_rest, "suspension-rest" );
CHECK_NEG(m_jump_velocity, "jump-velocity" );
CHECK_NEG(m_explosion_impulse, "explosion-impulse" );
// Precompute some handy values to reduce work later
@ -139,7 +140,7 @@ void STKConfig::init_defaults()
m_wheelie_lean_recovery = m_wheelie_step = m_wheelie_balance_recovery =
m_wheelie_power_boost = m_chassis_linear_damping = m_chassis_angular_damping =
m_maximum_speed = m_brake_force = m_gravity_center_shift = m_suspension_rest =
m_max_speed_reverse_ratio = m_explosion_impulse = -99.9f;
m_max_speed_reverse_ratio = m_explosion_impulse = m_jump_velocity = -99.9f;
m_max_karts = -100;
m_air_res_reduce[0] = 1.0f;