1) Simplified rescue code somewhat (one-time setup of variables is now

done in forceRescue, not in an if-statement in update anymore).
2) Made the parameters for rescue configurable in stk_config.xml
   (in preparation for other similar animations). E.g. the rescue time
   can now be set per kart.
3) Reset animations on restart (so that e.g. a win/lose animation
   is not shown during startup in case of a restart anymore).
4) Removed unused variable m_current_gear_ratio
5) Added documentation.



git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@5193 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk 2010-04-14 00:14:20 +00:00
parent 7e998399cd
commit 232d9a2540
6 changed files with 160 additions and 112 deletions

View File

@ -96,6 +96,15 @@
<!-- Camera: Distance between kart and camera. --> <!-- Camera: Distance between kart and camera. -->
<camera distance="1.5"/> <camera distance="1.5"/>
<!-- Rescue: time: How long it takes the kart to be raised.
height: how height the kart will be raised before it is
dropped back onto the track.
vert rescue offset: used to raise karts a bit higher before
releasing them on the ground after a rescue. Used to avoid
resetting karts into the track. Not sure if this is still
necessary. -->
<rescue vert-offset="0.0" time="2" height="2"/>
<!-- Nitro: power-boost is the increase in engine power, i.e. 1=plus 100% --> <!-- Nitro: power-boost is the increase in engine power, i.e. 1=plus 100% -->
<nitro power-boost="3"/> <nitro power-boost="3"/>
@ -208,12 +217,6 @@
pushed to the side, hardly anything happens. --> pushed to the side, hardly anything happens. -->
<collision side-impulse="0"/> <collision side-impulse="0"/>
<!-- vert rescue offset: used to raise karts a bit higher before
releasing them on the ground after a rescue. Used to avoid
resetting karts into the track. Not sure if this is still
necessary. -->
<rescue vert-offset="0.0"/>
<!-- Kart-specific rubber band handling: max-length is the <!-- Kart-specific rubber band handling: max-length is the
maximum length of rubber band before it snaps. force is maximum length of rubber band before it snaps. force is
the force a plunger/rubber band applies to the kart(s). the force a plunger/rubber band applies to the kart(s).

View File

@ -56,6 +56,12 @@
# pragma warning(disable:4355) # pragma warning(disable:4355)
#endif #endif
/** The kart constructor.
* \param ident The identifier for the kart model to use.
* \param position The position (or rank) for this kart (between 1 and
* number of karts). This is used to determine the start position.
* \param init_transform The initial position and rotation for this kart.
*/
Kart::Kart (const std::string& ident, int position, Kart::Kart (const std::string& ident, int position,
const btTransform& init_transform) const btTransform& init_transform)
: TerrainInfo(1), : TerrainInfo(1),
@ -158,7 +164,12 @@ void Kart::setController(Controller *controller)
} // setController } // setController
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
/** Returns a transform that will align an object with the kart: the heading
* and the pitch will be set appropriately. A custom pitch value can be
* specified in order to overwrite the terrain pitch (which would be used
* otherwise).
* \param customPitch Pitch value to overwrite the terrain pitch.
*/
btTransform Kart::getKartHeading(const float customPitch) btTransform Kart::getKartHeading(const float customPitch)
{ {
btTransform trans = getTrans(); btTransform trans = getTrans();
@ -173,7 +184,7 @@ btTransform Kart::getKartHeading(const float customPitch)
} // getKartHeading } // getKartHeading
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
/** Created the physical representation of this kart. Atm it uses the actual /** Creates the physical representation of this kart. Atm it uses the actual
* extention of the kart model to determine the size of the collision body. * extention of the kart model to determine the size of the collision body.
*/ */
void Kart::createPhysics() void Kart::createPhysics()
@ -268,7 +279,11 @@ void Kart::createPhysics()
} }
} // createPhysics } // createPhysics
// ----------------------------------------------------------------------------- // ----------------------------------------------------------------------------
/** The destructor frees the memory of this kart, but note that the actual kart
* model is still stored in the kart_properties (m_kart_model variable), so
* it is not reloaded).
*/
Kart::~Kart() Kart::~Kart()
{ {
//stop the engine sound //stop the engine sound
@ -325,14 +340,11 @@ void Kart::eliminate()
} }
m_kart_mode = KM_ELIMINATED; m_kart_mode = KM_ELIMINATED;
// make the kart invisible by placing it way under the track
getNode()->setVisible(false); getNode()->setVisible(false);
} // eliminate } // eliminate
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
/** Returns true if the kart is 'resting' /** Returns true if the kart is 'resting', i.e. (nearly) not moving.
*
* Returns true if the kart is 'resting', i.e. (nearly) not moving.
*/ */
bool Kart::isInRest() const bool Kart::isInRest() const
{ {
@ -364,7 +376,8 @@ void Kart::updatedWeight()
} // updatedWeight } // updatedWeight
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
/** Reset before a new race. /** Reset before a new race. It will remove all attachments, and
* puts the kart back at its original start position.
*/ */
void Kart::reset() void Kart::reset()
{ {
@ -381,6 +394,8 @@ void Kart::reset()
m_camera->setInitialTransform(); m_camera->setInitialTransform();
} }
// Stop any animations currently being played.
m_kart_properties->getKartModel()->setAnimation(KartModel::AF_DEFAULT);
// If the controller was replaced (e.g. replaced by end controller), // If the controller was replaced (e.g. replaced by end controller),
// restore the original controller. // restore the original controller.
if(m_saved_controller) if(m_saved_controller)
@ -511,6 +526,13 @@ void Kart::finishedRace(float time)
} // finishedRace } // finishedRace
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
/** Called when an item is collected. It will either adjust the collected
* energy, or update the attachment or powerup for this kart.
* \param item The item that was hit.
* \param add_info Additional info, used in networking games to force
* a specific item to be used (instead of a random item) to keep
* all karts in synch.
*/
void Kart::collectedItem(const Item &item, int add_info) void Kart::collectedItem(const Item &item, int add_info)
{ {
float old_energy = m_collected_energy; float old_energy = m_collected_energy;
@ -559,7 +581,9 @@ void Kart::collectedItem(const Item &item, int add_info)
} // collectedItem } // collectedItem
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Simulates gears /** Simulates gears by adjusting the force of the engine. It also takes the
* effect of the zipper into account.
*/
float Kart::getActualWheelForce() float Kart::getActualWheelForce()
{ {
float zipperF=(m_zipper_time_left>0.0f) ? stk_config->m_zipper_force : 0.0f; float zipperF=(m_zipper_time_left>0.0f) ? stk_config->m_zipper_force : 0.0f;
@ -568,8 +592,8 @@ float Kart::getActualWheelForce()
{ {
if(m_speed <= getMaxSpeed()*gear_ratio[i]) if(m_speed <= getMaxSpeed()*gear_ratio[i])
{ {
m_current_gear_ratio = gear_ratio[i]; return getMaxPower()*m_kart_properties->getGearPowerIncrease()[i]
return getMaxPower()*m_kart_properties->getGearPowerIncrease()[i]+zipperF; +zipperF;
} }
} }
return getMaxPower()+zipperF; return getMaxPower()+zipperF;
@ -577,7 +601,7 @@ float Kart::getActualWheelForce()
} // getActualWheelForce } // getActualWheelForce
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
/** The kart is on ground if all 4 wheels touch the ground /** The kart is on ground if all 4 wheels touch the ground.
*/ */
bool Kart::isOnGround() const bool Kart::isOnGround() const
{ {
@ -588,7 +612,6 @@ bool Kart::isOnGround() const
* is used to determine when to switch off the upright constraint, so that * is used to determine when to switch off the upright constraint, so that
* explosions can be more violent, while still * explosions can be more violent, while still
*/ */
bool Kart::isNearGround() const bool Kart::isNearGround() const
{ {
if(getHoT()==Track::NOHIT) if(getHoT()==Track::NOHIT)
@ -597,6 +620,11 @@ bool Kart::isNearGround() const
return ((getXYZ().getZ() - getHoT()) < stk_config->m_near_ground); return ((getXYZ().getZ() - getHoT()) < stk_config->m_near_ground);
} // isNearGround } // isNearGround
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
/** Called when an explosion happens.
* \param pos Position of the explosion.
* \param direct_hit True if this kart was hit directly (and should therefore
* be more severly affected).
*/
void Kart::handleExplosion(const Vec3& pos, bool direct_hit) void Kart::handleExplosion(const Vec3& pos, bool direct_hit)
{ {
int sign_bits = rand(); // To select plus or minus randomnly, assuming 15 bit at least int sign_bits = rand(); // To select plus or minus randomnly, assuming 15 bit at least
@ -652,6 +680,10 @@ void Kart::handleExplosion(const Vec3& pos, bool direct_hit)
} // handleExplosion } // handleExplosion
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
/** Updates the kart in each time step. It updates the physics setting,
* particle effects, camera position, etc.
* \param dt Time step size.
*/
void Kart::update(float dt) void Kart::update(float dt)
{ {
if(!history->replayHistory()) if(!history->replayHistory())
@ -713,23 +745,16 @@ void Kart::update(float dt)
if ( m_kart_mode==KM_RESCUE ) if ( m_kart_mode==KM_RESCUE )
{ {
// Let the kart raise 2m in the 2 seconds of the rescue // Let the kart raise 2m in the 2 seconds of the rescue
const float rescue_time = 2.0f; const float rescue_time = m_kart_properties->getRescueTime();
const float rescue_height = 2.0f; const float rescue_height = 2.0f;
if(m_attachment->getType() != ATTACH_TINYTUX)
{
m_attachment->set( ATTACH_TINYTUX, rescue_time ) ;
m_rescue_pitch = getHPR().getPitch();
m_rescue_roll = getHPR().getRoll();
race_state->itemCollected(getWorldKartId(), -1, -1);
}
World::getWorld()->getPhysics()->removeKart(this);
btQuaternion q_roll (btVector3(0.0f, 0.0f, 1.0f), btQuaternion q_roll (btVector3(0.0f, 0.0f, 1.0f),
-m_rescue_roll*dt/rescue_time*M_PI/180.0f); -m_rescue_roll*dt/rescue_time*DEGREE_TO_RAD);
btQuaternion q_pitch(btVector3(1.f, 0.f, 0.f), btQuaternion q_pitch(btVector3(1.f, 0.f, 0.f),
-m_rescue_pitch*dt/rescue_time*M_PI/180.0f); -m_rescue_pitch*dt/rescue_time*DEGREE_TO_RAD);
setXYZRotation(getXYZ()+Vec3(0, rescue_height*dt/rescue_time, 0), setXYZ(getXYZ()+Vec3(0,
getRotation()*q_roll*q_pitch); m_kart_properties->getRescueHeight()*dt/rescue_time,
0));
setRotation(getRotation()*q_roll*q_pitch);
} // if rescue mode } // if rescue mode
m_attachment->update(dt); m_attachment->update(dt);
@ -772,13 +797,6 @@ void Kart::update(float dt)
// happening (since Z velocity is clamped), the epsilon is left in place // happening (since Z velocity is clamped), the epsilon is left in place
// just to be on the safe side (it will not hit the chassis itself). // just to be on the safe side (it will not hit the chassis itself).
Vec3 pos_plus_epsilon = trans.getOrigin()+btVector3(0,0.3f,0); Vec3 pos_plus_epsilon = trans.getOrigin()+btVector3(0,0.3f,0);
// These values cause the track not to be hit in tuxtrack. I leave
// them in as a test case if additional debugging should be needed.
// Note: it might be that the kart chassis is actually 'in' the track,
// i.e. it's a tunneling problem!
//btVector3 pos_plus_epsilon (-54.449902, -139.99402, -3.4524240);
// motionstate: -52.449902, -139.99402, -3.6524241
// collision object -52.221024, -139.99614, -3.5276926
// Make sure that the ray doesn't hit the kart. This is done by // Make sure that the ray doesn't hit the kart. This is done by
// resetting the collision filter group, so that this collision // resetting the collision filter group, so that this collision
@ -1084,10 +1102,13 @@ bool Kart::playCustomSFX(unsigned int type)
return ret; return ret;
*/ */
} }
// ----------------------------------------------------------------------------- // ----------------------------------------------------------------------------
/** Updates the physics for this kart: computing the driving force, set
* steering, handles skidding, terrain impact on kart, ...
* \param dt Time step size.
*/
void Kart::updatePhysics(float dt) void Kart::updatePhysics(float dt)
{ {
m_bounce_back_time-=dt; m_bounce_back_time-=dt;
float engine_power = getActualWheelForce() + handleNitro(dt) float engine_power = getActualWheelForce() + handleNitro(dt)
+ handleSlipstream(dt); + handleSlipstream(dt);
@ -1304,11 +1325,23 @@ void Kart::updatePhysics(float dt)
} // updatePhysics } // updatePhysics
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
/** Sets the mode of the kart to being rescued. /** Sets the mode of the kart to being rescued, attaches the rescue model
* and saves the current pitch and roll (for the rescue animation). It
* also removes the kart from the physics world.
*/ */
void Kart::forceRescue() void Kart::forceRescue()
{ {
m_kart_mode=KM_RESCUE; m_kart_mode=KM_RESCUE;
// Just in case that rescue is pressed while the kart is being rescued
if(m_attachment->getType() != ATTACH_TINYTUX)
{
m_attachment->set( ATTACH_TINYTUX, m_kart_properties->getRescueTime());
m_rescue_pitch = getPitch();
m_rescue_roll = getRoll();
race_state->itemCollected(getWorldKartId(), -1, -1);
World::getWorld()->getPhysics()->removeKart(this);
}
} // forceRescue } // forceRescue
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -1331,7 +1364,9 @@ void Kart::endRescue()
} // endRescue } // endRescue
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
/** Attaches the right model, creates the physics and loads all special
* effects (particle systems etc.)
*/
void Kart::loadData() void Kart::loadData()
{ {
m_kart_properties->getKartModel()->attachModel(&m_node); m_kart_properties->getKartModel()->attachModel(&m_node);
@ -1400,8 +1435,6 @@ void Kart::applyEngineForce(float force)
} // applyEngineForce } // applyEngineForce
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void Kart::updateGraphics(const Vec3& offset_xyz,
const btQuaternion& rotation)
/** Updates the graphics model. Mainly set the graphical position to be the /** Updates the graphics model. Mainly set the graphical position to be the
* same as the physics position, but uses offsets to position and rotation * same as the physics position, but uses offsets to position and rotation
* for special gfx effects (e.g. skidding will turn the karts more). These * for special gfx effects (e.g. skidding will turn the karts more). These
@ -1410,6 +1443,8 @@ void Kart::updateGraphics(const Vec3& offset_xyz,
* \param offset_xyz Offset to be added to the position. * \param offset_xyz Offset to be added to the position.
* \param rotation Additional rotation. * \param rotation Additional rotation.
*/ */
void Kart::updateGraphics(const Vec3& offset_xyz,
const btQuaternion& rotation)
{ {
float wheel_up_axis[4]; float wheel_up_axis[4];
KartModel *kart_model = m_kart_properties->getKartModel(); KartModel *kart_model = m_kart_properties->getKartModel();

View File

@ -174,7 +174,6 @@ private:
* > 0 the number it contains is the time left before removing plunger. */ * > 0 the number it contains is the time left before removing plunger. */
float m_view_blocked_by_plunger; float m_view_blocked_by_plunger;
float m_speed; float m_speed;
float m_current_gear_ratio;
/** Different kart modes: normal racing, being rescued, showing end /** Different kart modes: normal racing, being rescued, showing end
* animation, explosions, kart eliminated. */ * animation, explosions, kart eliminated. */
enum {KM_RACE, KM_RESCUE, KM_END_ANIM, KM_EXPLOSION, enum {KM_RACE, KM_RESCUE, KM_END_ANIM, KM_EXPLOSION,

View File

@ -62,7 +62,7 @@ KartProperties::KartProperties(const std::string &filename) : m_icon_material(0)
m_wheel_radius = m_chassis_linear_damping = m_wheel_radius = m_chassis_linear_damping =
m_chassis_angular_damping = m_suspension_rest = m_chassis_angular_damping = m_suspension_rest =
m_max_speed_reverse_ratio = m_jump_velocity = m_max_speed_reverse_ratio = m_jump_velocity =
m_vert_rescue_offset = m_upright_tolerance = m_collision_side_impulse = m_rescue_vert_offset = m_upright_tolerance = m_collision_side_impulse =
m_upright_max_force = m_suspension_travel_cm = m_upright_max_force = m_suspension_travel_cm =
m_track_connection_accel = m_min_speed_turn = m_angle_at_min = m_track_connection_accel = m_min_speed_turn = m_angle_at_min =
m_max_speed_turn = m_angle_at_max = m_max_speed_turn = m_angle_at_max =
@ -71,7 +71,8 @@ KartProperties::KartProperties(const std::string &filename) : m_icon_material(0)
m_skid_decrease = m_skid_increase = m_skid_visual = m_skid_max = m_skid_decrease = m_skid_increase = m_skid_visual = m_skid_max =
m_slipstream_length = m_slipstream_collect_time = m_slipstream_length = m_slipstream_collect_time =
m_slipstream_use_time = m_slipstream_add_power = m_slipstream_use_time = m_slipstream_add_power =
m_slipstream_min_speed = m_camera_distance = UNDEFINED; m_slipstream_min_speed = m_camera_distance =
m_rescue_time = m_rescue_height = UNDEFINED;
m_gravity_center_shift = Vec3(UNDEFINED); m_gravity_center_shift = Vec3(UNDEFINED);
m_has_skidmarks = true; m_has_skidmarks = true;
m_version = 0; m_version = 0;
@ -179,6 +180,9 @@ void KartProperties::load(const std::string &filename, const std::string &node)
} // load } // load
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
/** Actually reads in the data from the xml file.
* \param root Root of the xml tree.
*/
void KartProperties::getAllData(const XMLNode * root) void KartProperties::getAllData(const XMLNode * root)
{ {
root->get("version", &m_version); root->get("version", &m_version);
@ -203,6 +207,13 @@ void KartProperties::getAllData(const XMLNode * root)
if(const XMLNode *nitro_node = root->getNode("nitro")) if(const XMLNode *nitro_node = root->getNode("nitro"))
nitro_node->get("power-boost", &m_nitro_power_boost); nitro_node->get("power-boost", &m_nitro_power_boost);
if(const XMLNode *rescue_node = root->getNode("rescue"))
{
rescue_node->get("vert-offset", &m_rescue_vert_offset);
rescue_node->get("time", &m_rescue_time );
rescue_node->get("height", &m_rescue_height );
}
if(const XMLNode *skid_node = root->getNode("skid")) if(const XMLNode *skid_node = root->getNode("skid"))
{ {
skid_node->get("increase", &m_skid_increase ); skid_node->get("increase", &m_skid_increase );
@ -334,9 +345,6 @@ void KartProperties::getAllData(const XMLNode * root)
if(const XMLNode *collision_node = root->getNode("collision")) if(const XMLNode *collision_node = root->getNode("collision"))
collision_node->get("side-impulse", &m_collision_side_impulse); collision_node->get("side-impulse", &m_collision_side_impulse);
if(const XMLNode *rescue_node = root->getNode("rescue"))
rescue_node->get("vert-offset", &m_vert_rescue_offset);
//TODO: wheel front right and wheel front left is not loaded, yet is listed as an attribute in the xml file after wheel-radius //TODO: wheel front right and wheel front left is not loaded, yet is listed as an attribute in the xml file after wheel-radius
//TODO: same goes for their rear equivalents //TODO: same goes for their rear equivalents
@ -415,53 +423,52 @@ void KartProperties::checkAllSet(const std::string &filename)
} }
CHECK_NEG(m_mass, "mass" ); CHECK_NEG(m_mass, "mass" );
CHECK_NEG(m_engine_power[0], "engine-power[0]" ); CHECK_NEG(m_min_speed_turn, "turn min-speed-angle" );
CHECK_NEG(m_engine_power[1], "engine-power[1]" ); CHECK_NEG(m_min_radius, "turn min-speed-angle" );
CHECK_NEG(m_engine_power[2], "engine-power[2]" ); CHECK_NEG(m_max_speed_turn, "turn max-speed-angle" );
CHECK_NEG(m_min_speed_turn, "min-speed-angle" ); CHECK_NEG(m_max_radius, "turn max-speed-angle" );
CHECK_NEG(m_min_radius, "min-speed-angle" ); CHECK_NEG(m_time_full_steer, "turn time-full-steer" );
CHECK_NEG(m_max_speed_turn, "max-speed-angle" ); CHECK_NEG(m_time_full_steer_ai, "turn time-full-steer-ai" );
CHECK_NEG(m_max_radius, "max-speed-angle" ); CHECK_NEG(m_wheel_damping_relaxation, "wheels damping-relaxation" );
CHECK_NEG(m_brake_factor, "brake-factor" ); CHECK_NEG(m_wheel_damping_compression, "wheels damping-compression" );
CHECK_NEG(m_time_full_steer, "time-full-steer" ); CHECK_NEG(m_wheel_radius, "wheels radius" );
CHECK_NEG(m_time_full_steer_ai, "time-full-steer-ai" ); CHECK_NEG(m_friction_slip, "friction slip" );
CHECK_NEG(m_roll_influence, "stability roll-influence" );
//bullet physics data CHECK_NEG(m_chassis_linear_damping, "stability chassis-linear-damping");
CHECK_NEG(m_suspension_stiffness, "suspension-stiffness" ); CHECK_NEG(m_chassis_angular_damping, "stability chassis-angular-damping");
CHECK_NEG(m_wheel_damping_relaxation, "wheel-damping-relaxation" ); CHECK_NEG(m_engine_power[0], "engine power[0]" );
CHECK_NEG(m_wheel_damping_compression, "wheel-damping-compression" ); CHECK_NEG(m_engine_power[1], "engine power[1]" );
CHECK_NEG(m_friction_slip, "friction-slip" ); CHECK_NEG(m_engine_power[2], "engine power[2]" );
CHECK_NEG(m_roll_influence, "roll-influence" ); CHECK_NEG(m_max_speed[0], "engine maximum-speed[0]" );
CHECK_NEG(m_wheel_radius, "wheel-radius" ); CHECK_NEG(m_max_speed[1], "engine maximum-speed[1]" );
// Don't check m_wheel_base here, it is computed later! CHECK_NEG(m_max_speed[2], "engine maximum-speed[2]" );
CHECK_NEG(m_chassis_linear_damping, "chassis-linear-damping" ); CHECK_NEG(m_max_speed_reverse_ratio, "engine max-speed-reverse-ratio");
CHECK_NEG(m_chassis_angular_damping, "chassis-angular-damping" ); CHECK_NEG(m_brake_factor, "engine brake-factor" );
CHECK_NEG(m_max_speed[0], "maximum-speed[0]" ); CHECK_NEG(m_suspension_stiffness, "suspension stiffness" );
CHECK_NEG(m_max_speed[1], "maximum-speed[1]" ); CHECK_NEG(m_suspension_rest, "suspension rest" );
CHECK_NEG(m_max_speed[2], "maximum-speed[2]" ); CHECK_NEG(m_suspension_travel_cm, "suspension travel-cm" );
CHECK_NEG(m_max_speed_reverse_ratio, "max-speed-reverse-ratio" ); CHECK_NEG(m_collision_side_impulse, "collision side-impulse" );
CHECK_NEG(m_suspension_rest, "suspension-rest" ); CHECK_NEG(m_jump_velocity, "jump velocity" );
CHECK_NEG(m_suspension_travel_cm, "suspension-travel-cm" ); CHECK_NEG(m_upright_tolerance, "upright tolerance" );
CHECK_NEG(m_collision_side_impulse, "collision-side-impulse" ); CHECK_NEG(m_upright_max_force, "upright max-force" );
CHECK_NEG(m_jump_velocity, "jump-velocity" );
CHECK_NEG(m_vert_rescue_offset, "vert-rescue-offset" );
CHECK_NEG(m_upright_tolerance, "upright-tolerance" );
CHECK_NEG(m_upright_max_force, "upright-max-force" );
CHECK_NEG(m_track_connection_accel, "track-connection-accel" ); CHECK_NEG(m_track_connection_accel, "track-connection-accel" );
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_decrease, "skid decrease" );
CHECK_NEG(m_time_till_max_skid, "time-till-max-skid" ); CHECK_NEG(m_time_till_max_skid, "skid time-till-max" );
CHECK_NEG(m_skid_increase, "skid-increase" ); CHECK_NEG(m_skid_increase, "skid increase" );
CHECK_NEG(m_skid_max, "skid-max" ); CHECK_NEG(m_skid_max, "skid max" );
CHECK_NEG(m_skid_visual, "skid-visual" ); CHECK_NEG(m_skid_visual, "skid visual" );
CHECK_NEG(m_slipstream_length, "slipstream-length" ); CHECK_NEG(m_slipstream_length, "slipstream length" );
CHECK_NEG(m_slipstream_collect_time, "slipstream-collect-time" ); CHECK_NEG(m_slipstream_collect_time, "slipstream collect-time" );
CHECK_NEG(m_slipstream_use_time, "slipstream-use-time" ); CHECK_NEG(m_slipstream_use_time, "slipstream use-time" );
CHECK_NEG(m_slipstream_add_power, "slipstream-add-power" ); CHECK_NEG(m_slipstream_add_power, "slipstream add-power" );
CHECK_NEG(m_slipstream_min_speed, "slipstream-min-speed" ); CHECK_NEG(m_slipstream_min_speed, "slipstream min-speed" );
CHECK_NEG(m_camera_distance, "camera distance" ); CHECK_NEG(m_camera_distance, "camera distance" );
CHECK_NEG(m_rescue_height, "rescue height" );
CHECK_NEG(m_rescue_time, "rescue time" );
CHECK_NEG(m_rescue_vert_offset, "rescue vert-offset" );
} // checkAllSet } // checkAllSet

View File

@ -106,6 +106,15 @@ private:
kart length. */ kart length. */
m_max_radius; /**< Largest turn radius. */ m_max_radius; /**< Largest turn radius. */
/** Time a kart is moved upwards after when it is rescued. */
float m_rescue_time;
/** Distance the kart is raised before dropped. */
float m_rescue_height;
/** Vertical offset after rescue. */
float m_rescue_vert_offset;
std::string m_wheel_filename[4]; /**< Filename of the wheel models. */ std::string m_wheel_filename[4]; /**< Filename of the wheel models. */
/** Radius of the graphical wheels. */ /** Radius of the graphical wheels. */
float m_wheel_graphics_radius[4]; float m_wheel_graphics_radius[4];
@ -138,7 +147,6 @@ private:
* out of the way of the faster kart in case of a collision. */ * out of the way of the faster kart in case of a collision. */
float m_collision_side_impulse; float m_collision_side_impulse;
float m_jump_velocity; /**< Vertical velocity set when jumping. */ float m_jump_velocity; /**< Vertical velocity set when jumping. */
float m_vert_rescue_offset; /**< Vertical offset after rescue. */
float m_upright_tolerance; float m_upright_tolerance;
float m_upright_max_force; float m_upright_max_force;
@ -234,7 +242,11 @@ public:
float getCollisionSideImpulse () const {return m_collision_side_impulse; } float getCollisionSideImpulse () const {return m_collision_side_impulse; }
/** Returns the vertical offset when rescuing karts to avoid karts being /** Returns the vertical offset when rescuing karts to avoid karts being
* rescued in (or under) the track. */ * rescued in (or under) the track. */
float getVertRescueOffset () const {return m_vert_rescue_offset; } float getVertRescueOffset () const {return m_rescue_vert_offset; }
/** Returns the time a kart is rised during a rescue. */
float getRescueTime () const {return m_rescue_time; }
/** Returns the height a kart is moved to during a rescue. */
float getRescueHeight () const {return m_rescue_height; }
float getUprightTolerance () const {return m_upright_tolerance; } float getUprightTolerance () const {return m_upright_tolerance; }
float getUprightMaxForce () const {return m_upright_max_force; } float getUprightMaxForce () const {return m_upright_max_force; }
float getTrackConnectionAccel () const {return m_track_connection_accel; } float getTrackConnectionAccel () const {return m_track_connection_accel; }

View File

@ -100,14 +100,6 @@ public:
m_motion_state->setWorldTransform(m_transform); m_motion_state->setWorldTransform(m_transform);
} }
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
/** Sets XYZ position and rotation of this moveable. */
void setXYZRotation(const Vec3& xyz, const btQuaternion& a)
{
m_transform.setRotation(a);
m_transform.setOrigin(xyz);
m_motion_state->setWorldTransform(m_transform);
}
// ------------------------------------------------------------------------
virtual void handleZipper () {}; virtual void handleZipper () {};
virtual void updateGraphics(const Vec3& off_xyz, virtual void updateGraphics(const Vec3& off_xyz,
const btQuaternion& off_rotation); const btQuaternion& off_rotation);