Merge remote-tracking branch 'origin/master' into advanced_recording
This commit is contained in:
commit
b2d3817de3
@ -29,13 +29,16 @@ export ASSETS_PATHS="../data \
|
|||||||
export ASSETS_DIRS="library models music sfx textures"
|
export ASSETS_DIRS="library models music sfx textures"
|
||||||
|
|
||||||
export TEXTURE_SIZE=256
|
export TEXTURE_SIZE=256
|
||||||
export SOUND_QUALITY=64
|
export SOUND_QUALITY=42
|
||||||
|
export SOUND_MONO=1
|
||||||
|
export SOUND_SAMPLE=32000
|
||||||
|
|
||||||
export RUN_OPTIMIZE_SCRIPT=0
|
export RUN_OPTIMIZE_SCRIPT=0
|
||||||
export DECREASE_QUALITY=1
|
export DECREASE_QUALITY=1
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
|
export LANG=C
|
||||||
|
|
||||||
cd "`dirname "$0"`"
|
cd "`dirname "$0"`"
|
||||||
|
|
||||||
@ -191,7 +194,22 @@ convert_sound()
|
|||||||
oggdec "$FILE" -o tmp.wav
|
oggdec "$FILE" -o tmp.wav
|
||||||
|
|
||||||
if [ -s tmp.wav ]; then
|
if [ -s tmp.wav ]; then
|
||||||
oggenc --downmix -b $SOUND_QUALITY tmp.wav -o tmp.ogg
|
OGGENC_CMD=""
|
||||||
|
|
||||||
|
if [ "$SOUND_MONO" -gt 0 ]; then
|
||||||
|
OGGENC_CMD="$OGGENC_CMD --downmix"
|
||||||
|
fi
|
||||||
|
|
||||||
|
OGG_RATE=`ogginfo "$FILE" | grep "Rate: " | cut -f 2 -d " " \
|
||||||
|
| grep -o '[0-9]*'`
|
||||||
|
|
||||||
|
if [ ! -z "$OGG_RATE" ] && [ "$OGG_RATE" -gt "32000" ]; then
|
||||||
|
OGGENC_CMD="$OGGENC_CMD --resample 32000"
|
||||||
|
fi
|
||||||
|
|
||||||
|
OGGENC_CMD="$OGGENC_CMD -b $SOUND_QUALITY"
|
||||||
|
|
||||||
|
oggenc $OGGENC_CMD tmp.wav -o tmp.ogg
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -s tmp.ogg ]; then
|
if [ -s tmp.ogg ]; then
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
http://bulletphysics.org/Bullet/phpBB3/viewtopic.php?f=9&t=7369\&p=25236&hilit=vehicle#p25236
|
http://bulletphysics.org/Bullet/phpBB3/viewtopic.php?f=9&t=7369\&p=25236&hilit=vehicle#p25236
|
||||||
for details.
|
for details.
|
||||||
max-force: Maximum suspension force -->
|
max-force: Maximum suspension force -->
|
||||||
<suspension stiffness="140" rest="0.3" travel="0.29"
|
<suspension stiffness="280" rest="0.3" travel="0.29"
|
||||||
exp-spring-response="false" max-force="12000" />
|
exp-spring-response="false" max-force="12000" />
|
||||||
|
|
||||||
<!-- Values related to stability of the chassis: damping, and reduced
|
<!-- Values related to stability of the chassis: damping, and reduced
|
||||||
@ -45,6 +45,9 @@
|
|||||||
the ground if its off ground. Reduces the affect if a kart loses
|
the ground if its off ground. Reduces the affect if a kart loses
|
||||||
contact with the ground (i.e. it then can't steer or accelerate
|
contact with the ground (i.e. it then can't steer or accelerate
|
||||||
anymore).
|
anymore).
|
||||||
|
angular-factor: Factor to change angular impulses. X and Z rotations
|
||||||
|
are damped to avoid that karts in a collision are too easily pushed
|
||||||
|
into a roll or pitch, which makes them topple over
|
||||||
smooth-flying-impulse: apply a torque impulse to flying kart to keep
|
smooth-flying-impulse: apply a torque impulse to flying kart to keep
|
||||||
them parallel to the ground. -->
|
them parallel to the ground. -->
|
||||||
<stability roll-influence="0.3"
|
<stability roll-influence="0.3"
|
||||||
@ -52,6 +55,7 @@
|
|||||||
chassis-angular-damping="0"
|
chassis-angular-damping="0"
|
||||||
downward-impulse-factor="5"
|
downward-impulse-factor="5"
|
||||||
track-connection-accel="2"
|
track-connection-accel="2"
|
||||||
|
angular-factor="0.5 1.0 0.5"
|
||||||
smooth-flying-impulse="250" />
|
smooth-flying-impulse="250" />
|
||||||
|
|
||||||
<!-- Turning
|
<!-- Turning
|
||||||
@ -120,6 +124,8 @@
|
|||||||
<rear-left position="-0.38 0 -0.6" />
|
<rear-left position="-0.38 0 -0.6" />
|
||||||
</wheels>
|
</wheels>
|
||||||
|
|
||||||
|
<!-- Friction of a kart when e.g. sliding along a wall. -->
|
||||||
|
<friction kart-friction="0.0" />
|
||||||
|
|
||||||
<!-- ********** Visuals ********** -->
|
<!-- ********** Visuals ********** -->
|
||||||
|
|
||||||
|
@ -92,9 +92,15 @@
|
|||||||
case (all three normals discarded, the interpolation will just
|
case (all three normals discarded, the interpolation will just
|
||||||
return the normal of the triangle (i.e. de facto no interpolation),
|
return the normal of the triangle (i.e. de facto no interpolation),
|
||||||
but it helps making smoothing much more useful without fixing tracks.
|
but it helps making smoothing much more useful without fixing tracks.
|
||||||
|
default-track-friction: Default friction to be used for the track and
|
||||||
|
any track/library pbject.
|
||||||
|
default-moveable-friction: Default friction to be used for any moveable,
|
||||||
|
e.g. karts, bowling balls, ...
|
||||||
-->
|
-->
|
||||||
<physics smooth-normals="true"
|
<physics smooth-normals="true"
|
||||||
smooth-angle-limit="0.65"/>
|
smooth-angle-limit="0.65"
|
||||||
|
default-track-friction="0.5"
|
||||||
|
default-moveable-friction="0.5" />
|
||||||
|
|
||||||
<!-- The title music. -->
|
<!-- The title music. -->
|
||||||
<music title="main_theme.music"/>
|
<music title="main_theme.music"/>
|
||||||
|
@ -591,7 +591,7 @@ SFXBuffer* SFXManager::loadSingleSfx(const XMLNode* node,
|
|||||||
// to load terrain specific sfx.
|
// to load terrain specific sfx.
|
||||||
const std::string full_path = (path == "")
|
const std::string full_path = (path == "")
|
||||||
? file_manager->getAsset(FileManager::SFX,filename)
|
? file_manager->getAsset(FileManager::SFX,filename)
|
||||||
: path;
|
: path+"/"+filename;
|
||||||
|
|
||||||
SFXBuffer tmpbuffer(full_path, node);
|
SFXBuffer tmpbuffer(full_path, node);
|
||||||
|
|
||||||
|
@ -138,6 +138,8 @@ void STKConfig::load(const std::string &filename)
|
|||||||
CHECK_NEG(m_replay_delta_pos2, "replay delta-position" );
|
CHECK_NEG(m_replay_delta_pos2, "replay delta-position" );
|
||||||
CHECK_NEG(m_replay_dt, "replay delta-t" );
|
CHECK_NEG(m_replay_dt, "replay delta-t" );
|
||||||
CHECK_NEG(m_smooth_angle_limit, "physics smooth-angle-limit" );
|
CHECK_NEG(m_smooth_angle_limit, "physics smooth-angle-limit" );
|
||||||
|
CHECK_NEG(m_default_track_friction, "physics default-track-friction");
|
||||||
|
CHECK_NEG(m_default_moveable_friction, "physics default-moveable-friction");
|
||||||
|
|
||||||
// Square distance to make distance checks cheaper (no sqrt)
|
// Square distance to make distance checks cheaper (no sqrt)
|
||||||
m_replay_delta_pos2 *= m_replay_delta_pos2;
|
m_replay_delta_pos2 *= m_replay_delta_pos2;
|
||||||
@ -156,6 +158,7 @@ void STKConfig::init_defaults()
|
|||||||
m_delay_finish_time = m_skid_fadeout_time =
|
m_delay_finish_time = m_skid_fadeout_time =
|
||||||
m_near_ground = m_item_switch_time =
|
m_near_ground = m_item_switch_time =
|
||||||
m_smooth_angle_limit = m_penalty_time =
|
m_smooth_angle_limit = m_penalty_time =
|
||||||
|
m_default_track_friction = m_default_moveable_friction =
|
||||||
UNDEFINED;
|
UNDEFINED;
|
||||||
m_bubblegum_counter = -100;
|
m_bubblegum_counter = -100;
|
||||||
m_shield_restrict_weapos = false;
|
m_shield_restrict_weapos = false;
|
||||||
@ -241,6 +244,9 @@ void STKConfig::getAllData(const XMLNode * root)
|
|||||||
{
|
{
|
||||||
physics_node->get("smooth-normals", &m_smooth_normals );
|
physics_node->get("smooth-normals", &m_smooth_normals );
|
||||||
physics_node->get("smooth-angle-limit", &m_smooth_angle_limit );
|
physics_node->get("smooth-angle-limit", &m_smooth_angle_limit );
|
||||||
|
physics_node->get("default-track-friction", &m_default_track_friction);
|
||||||
|
physics_node->get("default-moveable-friction",
|
||||||
|
&m_default_moveable_friction);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (const XMLNode *startup_node= root->getNode("startup"))
|
if (const XMLNode *startup_node= root->getNode("startup"))
|
||||||
|
@ -85,6 +85,13 @@ public:
|
|||||||
* triangle are more than this value, the physics will use the normal
|
* triangle are more than this value, the physics will use the normal
|
||||||
* of the triangle in smoothing normal. */
|
* of the triangle in smoothing normal. */
|
||||||
float m_smooth_angle_limit;
|
float m_smooth_angle_limit;
|
||||||
|
|
||||||
|
/** Default friction for the track and any track/library object. */
|
||||||
|
float m_default_track_friction;
|
||||||
|
|
||||||
|
/** Default friction to be used for any moveable, e.g. karts, balls. */
|
||||||
|
float m_default_moveable_friction;
|
||||||
|
|
||||||
int m_max_skidmarks; /**<Maximum number of skid marks/kart. */
|
int m_max_skidmarks; /**<Maximum number of skid marks/kart. */
|
||||||
float m_skid_fadeout_time; /**<Time till skidmarks fade away. */
|
float m_skid_fadeout_time; /**<Time till skidmarks fade away. */
|
||||||
float m_near_ground; /**<Determines when a kart is not near
|
float m_near_ground; /**<Determines when a kart is not near
|
||||||
|
@ -127,8 +127,13 @@ void CameraNormal::smoothMoveCamera(float dt)
|
|||||||
delta2 = 1;
|
delta2 = 1;
|
||||||
|
|
||||||
btTransform btt = m_kart->getTrans();
|
btTransform btt = m_kart->getTrans();
|
||||||
m_kart_position = btt.getOrigin();// m_kart_position + (btt.getOrigin() - m_kart_position) * delta2;
|
m_kart_position = btt.getOrigin();
|
||||||
m_kart_rotation = m_kart_rotation.normalized().slerp(btt.getRotation().normalized(), delta2);
|
btQuaternion q1, q2;
|
||||||
|
q1 = m_kart_rotation.normalized();
|
||||||
|
q2 = btt.getRotation().normalized();
|
||||||
|
if (dot(q1, q2) < 0.0f)
|
||||||
|
q2 = -q2;
|
||||||
|
m_kart_rotation = q1.slerp(q2, delta2);
|
||||||
|
|
||||||
btt.setOrigin(m_kart_position);
|
btt.setOrigin(m_kart_position);
|
||||||
btt.setRotation(m_kart_rotation);
|
btt.setRotation(m_kart_rotation);
|
||||||
|
@ -1190,12 +1190,12 @@ EventPropagation InputManager::input(const SEvent& event)
|
|||||||
|
|
||||||
if (UserConfigParams::m_multitouch_accelerometer == 1)
|
if (UserConfigParams::m_multitouch_accelerometer == 1)
|
||||||
{
|
{
|
||||||
button->axis_x = -event.AccelerometerEvent.X / 5.0f;
|
button->axis_x = (float)-event.AccelerometerEvent.X / 5.0f;
|
||||||
device->handleControls(button);
|
device->handleControls(button);
|
||||||
}
|
}
|
||||||
else if (UserConfigParams::m_multitouch_accelerometer == 2)
|
else if (UserConfigParams::m_multitouch_accelerometer == 2)
|
||||||
{
|
{
|
||||||
button->axis_x = event.AccelerometerEvent.Y / 5.0f;
|
button->axis_x = (float)event.AccelerometerEvent.Y / 5.0f;
|
||||||
device->handleControls(button);
|
device->handleControls(button);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -74,6 +74,8 @@ AbstractCharacteristic::ValueType AbstractCharacteristic::getType(
|
|||||||
return TYPE_FLOAT;
|
return TYPE_FLOAT;
|
||||||
case STABILITY_TRACK_CONNECTION_ACCEL:
|
case STABILITY_TRACK_CONNECTION_ACCEL:
|
||||||
return TYPE_FLOAT;
|
return TYPE_FLOAT;
|
||||||
|
case STABILITY_ANGULAR_FACTOR:
|
||||||
|
return TYPE_FLOAT_VECTOR;
|
||||||
case STABILITY_SMOOTH_FLYING_IMPULSE:
|
case STABILITY_SMOOTH_FLYING_IMPULSE:
|
||||||
return TYPE_FLOAT;
|
return TYPE_FLOAT;
|
||||||
case TURN_RADIUS:
|
case TURN_RADIUS:
|
||||||
@ -136,6 +138,8 @@ AbstractCharacteristic::ValueType AbstractCharacteristic::getType(
|
|||||||
return TYPE_FLOAT;
|
return TYPE_FLOAT;
|
||||||
case PARACHUTE_MAX_SPEED:
|
case PARACHUTE_MAX_SPEED:
|
||||||
return TYPE_FLOAT;
|
return TYPE_FLOAT;
|
||||||
|
case FRICTION_KART_FRICTION:
|
||||||
|
return TYPE_FLOAT;
|
||||||
case BUBBLEGUM_DURATION:
|
case BUBBLEGUM_DURATION:
|
||||||
return TYPE_FLOAT;
|
return TYPE_FLOAT;
|
||||||
case BUBBLEGUM_SPEED_FRACTION:
|
case BUBBLEGUM_SPEED_FRACTION:
|
||||||
@ -302,6 +306,8 @@ std::string AbstractCharacteristic::getName(CharacteristicType type)
|
|||||||
return "STABILITY_DOWNWARD_IMPULSE_FACTOR";
|
return "STABILITY_DOWNWARD_IMPULSE_FACTOR";
|
||||||
case STABILITY_TRACK_CONNECTION_ACCEL:
|
case STABILITY_TRACK_CONNECTION_ACCEL:
|
||||||
return "STABILITY_TRACK_CONNECTION_ACCEL";
|
return "STABILITY_TRACK_CONNECTION_ACCEL";
|
||||||
|
case STABILITY_ANGULAR_FACTOR:
|
||||||
|
return "STABILITY_ANGULAR_FACTOR";
|
||||||
case STABILITY_SMOOTH_FLYING_IMPULSE:
|
case STABILITY_SMOOTH_FLYING_IMPULSE:
|
||||||
return "STABILITY_SMOOTH_FLYING_IMPULSE";
|
return "STABILITY_SMOOTH_FLYING_IMPULSE";
|
||||||
case TURN_RADIUS:
|
case TURN_RADIUS:
|
||||||
@ -364,6 +370,8 @@ std::string AbstractCharacteristic::getName(CharacteristicType type)
|
|||||||
return "PARACHUTE_UBOUND_FRACTION";
|
return "PARACHUTE_UBOUND_FRACTION";
|
||||||
case PARACHUTE_MAX_SPEED:
|
case PARACHUTE_MAX_SPEED:
|
||||||
return "PARACHUTE_MAX_SPEED";
|
return "PARACHUTE_MAX_SPEED";
|
||||||
|
case FRICTION_KART_FRICTION:
|
||||||
|
return "FRICTION_KART_FRICTION";
|
||||||
case BUBBLEGUM_DURATION:
|
case BUBBLEGUM_DURATION:
|
||||||
return "BUBBLEGUM_DURATION";
|
return "BUBBLEGUM_DURATION";
|
||||||
case BUBBLEGUM_SPEED_FRACTION:
|
case BUBBLEGUM_SPEED_FRACTION:
|
||||||
@ -622,6 +630,18 @@ float AbstractCharacteristic::getStabilityTrackConnectionAccel() const
|
|||||||
return result;
|
return result;
|
||||||
} // getStabilityTrackConnectionAccel
|
} // getStabilityTrackConnectionAccel
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
std::vector<float> AbstractCharacteristic::getStabilityAngularFactor() const
|
||||||
|
{
|
||||||
|
std::vector<float> result;
|
||||||
|
bool is_set = false;
|
||||||
|
process(STABILITY_ANGULAR_FACTOR, &result, &is_set);
|
||||||
|
if (!is_set)
|
||||||
|
Log::fatal("AbstractCharacteristic", "Can't get characteristic %s",
|
||||||
|
getName(STABILITY_ANGULAR_FACTOR).c_str());
|
||||||
|
return result;
|
||||||
|
} // getStabilityAngularFactor
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
float AbstractCharacteristic::getStabilitySmoothFlyingImpulse() const
|
float AbstractCharacteristic::getStabilitySmoothFlyingImpulse() const
|
||||||
{
|
{
|
||||||
@ -994,6 +1014,18 @@ float AbstractCharacteristic::getParachuteMaxSpeed() const
|
|||||||
return result;
|
return result;
|
||||||
} // getParachuteMaxSpeed
|
} // getParachuteMaxSpeed
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
float AbstractCharacteristic::getFrictionKartFriction() const
|
||||||
|
{
|
||||||
|
float result;
|
||||||
|
bool is_set = false;
|
||||||
|
process(FRICTION_KART_FRICTION, &result, &is_set);
|
||||||
|
if (!is_set)
|
||||||
|
Log::fatal("AbstractCharacteristic", "Can't get characteristic %s",
|
||||||
|
getName(FRICTION_KART_FRICTION).c_str());
|
||||||
|
return result;
|
||||||
|
} // getFrictionKartFriction
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
float AbstractCharacteristic::getBubblegumDuration() const
|
float AbstractCharacteristic::getBubblegumDuration() const
|
||||||
{
|
{
|
||||||
|
@ -84,6 +84,7 @@ public:
|
|||||||
STABILITY_CHASSIS_ANGULAR_DAMPING,
|
STABILITY_CHASSIS_ANGULAR_DAMPING,
|
||||||
STABILITY_DOWNWARD_IMPULSE_FACTOR,
|
STABILITY_DOWNWARD_IMPULSE_FACTOR,
|
||||||
STABILITY_TRACK_CONNECTION_ACCEL,
|
STABILITY_TRACK_CONNECTION_ACCEL,
|
||||||
|
STABILITY_ANGULAR_FACTOR,
|
||||||
STABILITY_SMOOTH_FLYING_IMPULSE,
|
STABILITY_SMOOTH_FLYING_IMPULSE,
|
||||||
|
|
||||||
// Turn
|
// Turn
|
||||||
@ -136,6 +137,9 @@ public:
|
|||||||
PARACHUTE_UBOUND_FRACTION,
|
PARACHUTE_UBOUND_FRACTION,
|
||||||
PARACHUTE_MAX_SPEED,
|
PARACHUTE_MAX_SPEED,
|
||||||
|
|
||||||
|
// Friction
|
||||||
|
FRICTION_KART_FRICTION,
|
||||||
|
|
||||||
// Bubblegum
|
// Bubblegum
|
||||||
BUBBLEGUM_DURATION,
|
BUBBLEGUM_DURATION,
|
||||||
BUBBLEGUM_SPEED_FRACTION,
|
BUBBLEGUM_SPEED_FRACTION,
|
||||||
@ -266,6 +270,7 @@ public:
|
|||||||
float getStabilityChassisAngularDamping() const;
|
float getStabilityChassisAngularDamping() const;
|
||||||
float getStabilityDownwardImpulseFactor() const;
|
float getStabilityDownwardImpulseFactor() const;
|
||||||
float getStabilityTrackConnectionAccel() const;
|
float getStabilityTrackConnectionAccel() const;
|
||||||
|
std::vector<float> getStabilityAngularFactor() const;
|
||||||
float getStabilitySmoothFlyingImpulse() const;
|
float getStabilitySmoothFlyingImpulse() const;
|
||||||
|
|
||||||
InterpolationArray getTurnRadius() const;
|
InterpolationArray getTurnRadius() const;
|
||||||
@ -308,6 +313,8 @@ public:
|
|||||||
float getParachuteUboundFraction() const;
|
float getParachuteUboundFraction() const;
|
||||||
float getParachuteMaxSpeed() const;
|
float getParachuteMaxSpeed() const;
|
||||||
|
|
||||||
|
float getFrictionKartFriction() const;
|
||||||
|
|
||||||
float getBubblegumDuration() const;
|
float getBubblegumDuration() const;
|
||||||
float getBubblegumSpeedFraction() const;
|
float getBubblegumSpeedFraction() const;
|
||||||
float getBubblegumTorque() const;
|
float getBubblegumTorque() const;
|
||||||
|
@ -174,6 +174,7 @@ void CannonAnimation::update(float dt)
|
|||||||
AbstractKartAnimation::update(dt);
|
AbstractKartAnimation::update(dt);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
AbstractKartAnimation::update(dt);
|
||||||
|
|
||||||
// First compute the current rotation
|
// First compute the current rotation
|
||||||
// ==================================
|
// ==================================
|
||||||
@ -241,11 +242,14 @@ void CannonAnimation::update(float dt)
|
|||||||
// transform it to the global coordinate system
|
// transform it to the global coordinate system
|
||||||
Vec3 horiz_delta = Vec3(0.5f*m_fraction_of_line * f_current_width, 0, 0);
|
Vec3 horiz_delta = Vec3(0.5f*m_fraction_of_line * f_current_width, 0, 0);
|
||||||
|
|
||||||
Vec3 rotated_delta = quatRotate(all_heading, m_delta + horiz_delta);
|
// Determine direction orthogonal to the curve for the sideway movement
|
||||||
|
// of the kart.
|
||||||
|
Vec3 sideways = gravity.cross(tangent);
|
||||||
|
|
||||||
|
Vec3 rotated_delta = sideways*(0.5f*m_fraction_of_line * f_current_width)
|
||||||
|
+ quatRotate(all_heading, m_delta);
|
||||||
|
|
||||||
Vec3 curve_xyz;
|
Vec3 curve_xyz;
|
||||||
m_curve->update(dt, &curve_xyz);
|
m_curve->update(dt, &curve_xyz);
|
||||||
m_kart->setXYZ(curve_xyz+rotated_delta);
|
m_kart->setXYZ(curve_xyz+rotated_delta);
|
||||||
|
|
||||||
AbstractKartAnimation::update(dt);
|
|
||||||
} // update
|
} // update
|
||||||
|
@ -668,6 +668,11 @@ void Kart::createPhysics()
|
|||||||
trans.setIdentity();
|
trans.setIdentity();
|
||||||
createBody(mass, trans, &m_kart_chassis,
|
createBody(mass, trans, &m_kart_chassis,
|
||||||
m_kart_properties->getRestitution());
|
m_kart_properties->getRestitution());
|
||||||
|
std::vector<float> ang_fact = m_kart_properties->getStabilityAngularFactor();
|
||||||
|
// The angular factor (with X and Z values <1) helps to keep the kart
|
||||||
|
// upright, especially in case of a collision.
|
||||||
|
m_body->setAngularFactor(Vec3(ang_fact[0], ang_fact[1], ang_fact[2]));
|
||||||
|
m_body->setFriction(m_kart_properties->getFrictionKartFriction());
|
||||||
m_user_pointer.set(this);
|
m_user_pointer.set(this);
|
||||||
m_body->setDamping(m_kart_properties->getStabilityChassisLinearDamping(),
|
m_body->setDamping(m_kart_properties->getStabilityChassisLinearDamping(),
|
||||||
m_kart_properties->getStabilityChassisAngularDamping() );
|
m_kart_properties->getStabilityChassisAngularDamping() );
|
||||||
@ -2043,7 +2048,10 @@ void Kart::crashed(const Material *m, const Vec3 &normal)
|
|||||||
impulse *= ( abs_speed<10 ? 10.0f : sqrt(abs_speed) )
|
impulse *= ( abs_speed<10 ? 10.0f : sqrt(abs_speed) )
|
||||||
* m_kart_properties->getCollisionTerrainImpulse();
|
* m_kart_properties->getCollisionTerrainImpulse();
|
||||||
m_bounce_back_time = 0.2f;
|
m_bounce_back_time = 0.2f;
|
||||||
m_vehicle->setTimedCentralImpulse(0.1f, impulse);
|
m_bounce_back_time = 0.0f;;
|
||||||
|
impulse = Vec3(0, 0, 0);
|
||||||
|
//m_vehicle->setTimedCentralImpulse(0.1f, impulse);
|
||||||
|
m_vehicle->setTimedCentralImpulse(0.0, impulse);
|
||||||
}
|
}
|
||||||
// If there is a quad graph, push the kart towards the previous
|
// If there is a quad graph, push the kart towards the previous
|
||||||
// graph node center (we have to use the previous point since the
|
// graph node center (we have to use the previous point since the
|
||||||
@ -2345,13 +2353,13 @@ void Kart::updateEngineSFX(float dt)
|
|||||||
if (fc>1.0f) fc = 1.0f;
|
if (fc>1.0f) fc = 1.0f;
|
||||||
float gears = 3.0f * fmod(fc, 0.333334f);
|
float gears = 3.0f * fmod(fc, 0.333334f);
|
||||||
assert(!std::isnan(f));
|
assert(!std::isnan(f));
|
||||||
m_last_factor_engine_sound = (0.9*f + gears) * 0.35f;
|
m_last_factor_engine_sound = (0.9f*f + gears) * 0.35f;
|
||||||
m_engine_sound->setSpeedPosition(0.6f + m_last_factor_engine_sound, getXYZ());
|
m_engine_sound->setSpeedPosition(0.6f + m_last_factor_engine_sound, getXYZ());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// When flying, reduce progressively the sound engine (since we can't accelerate)
|
// When flying, reduce progressively the sound engine (since we can't accelerate)
|
||||||
m_last_factor_engine_sound *= (1.0f-0.1*dt);
|
m_last_factor_engine_sound *= (1.0f-0.1f*dt);
|
||||||
m_engine_sound->setSpeedPosition(0.6f + m_last_factor_engine_sound, getXYZ());
|
m_engine_sound->setSpeedPosition(0.6f + m_last_factor_engine_sound, getXYZ());
|
||||||
if (m_speed < 0.1f) m_last_factor_engine_sound = 0.0f;
|
if (m_speed < 0.1f) m_last_factor_engine_sound = 0.0f;
|
||||||
}
|
}
|
||||||
@ -2455,31 +2463,44 @@ void Kart::updateEnginePowerAndBrakes(float dt)
|
|||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
/** Handles sliding, i.e. the kart sliding off terrain that is too steep.
|
/** Handles sliding, i.e. the kart sliding off terrain that is too steep.
|
||||||
|
* Dynamically determine friction so that the kart looses its traction
|
||||||
|
* when trying to drive on too steep surfaces. Below angles of 0.25 rad,
|
||||||
|
* you have full traction; above 0.5 rad angles you have absolutely none;
|
||||||
|
* inbetween there is a linear change in friction. This is done for each
|
||||||
|
* wheel individually (since otherwise karts were still able with enough
|
||||||
|
* speed to drive on walls - one wheel 'on a wall' would not tilt the
|
||||||
|
* kart chassis enough to trigger sliding, but since that wheel had still
|
||||||
|
* full friction, give the kart an upwards velocity).
|
||||||
*/
|
*/
|
||||||
void Kart::updateSliding()
|
void Kart::updateSliding()
|
||||||
{
|
{
|
||||||
// dynamically determine friction so that the kart looses its traction
|
// Allow the sliding to be disabled per material (for so called
|
||||||
// when trying to drive on too steep surfaces. Below angles of 0.25 rad,
|
// high adhesion material), which is useful for e.g. banked curves.
|
||||||
// you have full traction; above 0.5 rad angles you have absolutely none;
|
// We don't have per-wheel material, so the test for special material
|
||||||
// inbetween there is a linear change in friction
|
// with high adhesion is done per kart (not per wheel).
|
||||||
float friction = 1.0f;
|
const Material * material = getMaterial();
|
||||||
bool enable_sliding = false;
|
if (material && material->highTireAdhesion())
|
||||||
|
|
||||||
// This way the current handling of sliding can be disabled
|
|
||||||
// for certain material (e.g. the curve in skyline on which otherwise
|
|
||||||
// karts could not drive).
|
|
||||||
// We also had a crash reported here, which was caused by not
|
|
||||||
// having a material here - no idea how this could have happened,
|
|
||||||
// but this problem is now avoided by testing if there is a material
|
|
||||||
if (isOnGround() &&
|
|
||||||
(!getMaterial() || !getMaterial()->highTireAdhesion()))
|
|
||||||
{
|
{
|
||||||
const btMatrix3x3 &m = m_vehicle->getChassisWorldTransform().getBasis();
|
for (int i = 0; i < m_vehicle->getNumWheels(); i++)
|
||||||
// To get the angle between up=(0,1,0), we have to do:
|
{
|
||||||
// m*(0,1,0) to get the up vector of the kart, then the
|
btWheelInfo &wheel = m_vehicle->getWheelInfo(i);
|
||||||
// scalar product between this and (0,1,0) - which is m[1][1]:
|
wheel.m_frictionSlip = m_kart_properties->getFrictionSlip();
|
||||||
float distanceFromUp = m[1][1];
|
}
|
||||||
|
m_vehicle->setSliding(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Now test for each wheel if it should be sliding
|
||||||
|
// -----------------------------------------------
|
||||||
|
bool enable_sliding = false;
|
||||||
|
for (int i = 0; i < m_vehicle->getNumWheels(); i++)
|
||||||
|
{
|
||||||
|
const btWheelInfo &wheel = m_vehicle->getWheelInfo(i);
|
||||||
|
if (!wheel.m_raycastInfo.m_isInContact) continue;
|
||||||
|
|
||||||
|
const btVector3 &norm = m_vehicle->getWheelInfo(i).m_raycastInfo.m_contactNormalWS;
|
||||||
|
float distanceFromUp = norm.dot(getNormal());
|
||||||
|
float friction;
|
||||||
if (distanceFromUp < 0.85f)
|
if (distanceFromUp < 0.85f)
|
||||||
{
|
{
|
||||||
friction = 0.0f;
|
friction = 0.0f;
|
||||||
@ -2494,13 +2515,8 @@ void Kart::updateSliding()
|
|||||||
friction = (distanceFromUp - 0.85f) / 0.5f;
|
friction = (distanceFromUp - 0.85f) / 0.5f;
|
||||||
enable_sliding = true;
|
enable_sliding = true;
|
||||||
}
|
}
|
||||||
}
|
m_vehicle->getWheelInfo(i).m_frictionSlip = friction * m_kart_properties->getFrictionSlip();
|
||||||
|
} // for i < numWheels
|
||||||
for (unsigned int i=0; i<4; i++)
|
|
||||||
{
|
|
||||||
btWheelInfo& wheel = m_vehicle->getWheelInfo(i);
|
|
||||||
wheel.m_frictionSlip = friction*m_kart_properties->getFrictionSlip();
|
|
||||||
}
|
|
||||||
|
|
||||||
m_vehicle->setSliding(enable_sliding);
|
m_vehicle->setSliding(enable_sliding);
|
||||||
} // updateSliding
|
} // updateSliding
|
||||||
|
@ -597,6 +597,12 @@ float KartProperties::getStabilityTrackConnectionAccel() const
|
|||||||
return m_cached_characteristic->getStabilityTrackConnectionAccel();
|
return m_cached_characteristic->getStabilityTrackConnectionAccel();
|
||||||
} // getStabilityTrackConnectionAccel
|
} // getStabilityTrackConnectionAccel
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
std::vector<float> KartProperties::getStabilityAngularFactor() const
|
||||||
|
{
|
||||||
|
return m_cached_characteristic->getStabilityAngularFactor();
|
||||||
|
} // getStabilityAngularFactor
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
float KartProperties::getStabilitySmoothFlyingImpulse() const
|
float KartProperties::getStabilitySmoothFlyingImpulse() const
|
||||||
{
|
{
|
||||||
@ -783,6 +789,12 @@ float KartProperties::getParachuteMaxSpeed() const
|
|||||||
return m_cached_characteristic->getParachuteMaxSpeed();
|
return m_cached_characteristic->getParachuteMaxSpeed();
|
||||||
} // getParachuteMaxSpeed
|
} // getParachuteMaxSpeed
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
float KartProperties::getFrictionKartFriction() const
|
||||||
|
{
|
||||||
|
return m_cached_characteristic->getFrictionKartFriction();
|
||||||
|
} // getFrictionKartFriction
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
float KartProperties::getBubblegumDuration() const
|
float KartProperties::getBubblegumDuration() const
|
||||||
{
|
{
|
||||||
|
@ -431,6 +431,7 @@ public:
|
|||||||
float getStabilityChassisAngularDamping() const;
|
float getStabilityChassisAngularDamping() const;
|
||||||
float getStabilityDownwardImpulseFactor() const;
|
float getStabilityDownwardImpulseFactor() const;
|
||||||
float getStabilityTrackConnectionAccel() const;
|
float getStabilityTrackConnectionAccel() const;
|
||||||
|
std::vector<float> getStabilityAngularFactor() const;
|
||||||
float getStabilitySmoothFlyingImpulse() const;
|
float getStabilitySmoothFlyingImpulse() const;
|
||||||
|
|
||||||
InterpolationArray getTurnRadius() const;
|
InterpolationArray getTurnRadius() const;
|
||||||
@ -473,6 +474,8 @@ public:
|
|||||||
float getParachuteUboundFraction() const;
|
float getParachuteUboundFraction() const;
|
||||||
float getParachuteMaxSpeed() const;
|
float getParachuteMaxSpeed() const;
|
||||||
|
|
||||||
|
float getFrictionKartFriction() const;
|
||||||
|
|
||||||
float getBubblegumDuration() const;
|
float getBubblegumDuration() const;
|
||||||
float getBubblegumSpeedFraction() const;
|
float getBubblegumSpeedFraction() const;
|
||||||
float getBubblegumTorque() const;
|
float getBubblegumTorque() const;
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include "karts/moveable.hpp"
|
#include "karts/moveable.hpp"
|
||||||
|
|
||||||
|
#include "config/stk_config.hpp"
|
||||||
#include "graphics/irr_driver.hpp"
|
#include "graphics/irr_driver.hpp"
|
||||||
#include "graphics/material.hpp"
|
#include "graphics/material.hpp"
|
||||||
#include "graphics/material_manager.hpp"
|
#include "graphics/material_manager.hpp"
|
||||||
@ -170,6 +171,7 @@ void Moveable::createBody(float mass, btTransform& trans,
|
|||||||
btRigidBody::btRigidBodyConstructionInfo info(mass, m_motion_state,
|
btRigidBody::btRigidBodyConstructionInfo info(mass, m_motion_state,
|
||||||
shape, inertia);
|
shape, inertia);
|
||||||
info.m_restitution = restitution;
|
info.m_restitution = restitution;
|
||||||
|
info.m_friction = stk_config->m_default_moveable_friction;
|
||||||
|
|
||||||
// Then create a rigid body
|
// Then create a rigid body
|
||||||
// ------------------------
|
// ------------------------
|
||||||
|
@ -343,6 +343,8 @@ void XmlCharacteristic::load(const XMLNode *node)
|
|||||||
&m_values[STABILITY_DOWNWARD_IMPULSE_FACTOR]);
|
&m_values[STABILITY_DOWNWARD_IMPULSE_FACTOR]);
|
||||||
sub_node->get("track-connection-accel",
|
sub_node->get("track-connection-accel",
|
||||||
&m_values[STABILITY_TRACK_CONNECTION_ACCEL]);
|
&m_values[STABILITY_TRACK_CONNECTION_ACCEL]);
|
||||||
|
sub_node->get("angular-factor",
|
||||||
|
&m_values[STABILITY_ANGULAR_FACTOR]);
|
||||||
sub_node->get("smooth-flying-impulse",
|
sub_node->get("smooth-flying-impulse",
|
||||||
&m_values[STABILITY_SMOOTH_FLYING_IMPULSE]);
|
&m_values[STABILITY_SMOOTH_FLYING_IMPULSE]);
|
||||||
}
|
}
|
||||||
@ -447,6 +449,12 @@ void XmlCharacteristic::load(const XMLNode *node)
|
|||||||
&m_values[PARACHUTE_MAX_SPEED]);
|
&m_values[PARACHUTE_MAX_SPEED]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (const XMLNode *sub_node = node->getNode("friction"))
|
||||||
|
{
|
||||||
|
sub_node->get("kart-friction",
|
||||||
|
&m_values[FRICTION_KART_FRICTION]);
|
||||||
|
}
|
||||||
|
|
||||||
if (const XMLNode *sub_node = node->getNode("bubblegum"))
|
if (const XMLNode *sub_node = node->getNode("bubblegum"))
|
||||||
{
|
{
|
||||||
sub_node->get("duration",
|
sub_node->get("duration",
|
||||||
|
@ -192,7 +192,8 @@ void btKart::resetSuspension()
|
|||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
void btKart::updateWheelTransformsWS(btWheelInfo& wheel,
|
void btKart::updateWheelTransformsWS(btWheelInfo& wheel,
|
||||||
bool interpolatedTransform)
|
bool interpolatedTransform,
|
||||||
|
float fraction)
|
||||||
{
|
{
|
||||||
wheel.m_raycastInfo.m_isInContact = false;
|
wheel.m_raycastInfo.m_isInContact = false;
|
||||||
|
|
||||||
@ -203,7 +204,7 @@ void btKart::updateWheelTransformsWS(btWheelInfo& wheel,
|
|||||||
}
|
}
|
||||||
|
|
||||||
wheel.m_raycastInfo.m_hardPointWS =
|
wheel.m_raycastInfo.m_hardPointWS =
|
||||||
chassisTrans( wheel.m_chassisConnectionPointCS );
|
chassisTrans( wheel.m_chassisConnectionPointCS*fraction );
|
||||||
wheel.m_raycastInfo.m_wheelDirectionWS = chassisTrans.getBasis() *
|
wheel.m_raycastInfo.m_wheelDirectionWS = chassisTrans.getBasis() *
|
||||||
wheel.m_wheelDirectionCS ;
|
wheel.m_wheelDirectionCS ;
|
||||||
wheel.m_raycastInfo.m_wheelAxleWS = chassisTrans.getBasis() *
|
wheel.m_raycastInfo.m_wheelAxleWS = chassisTrans.getBasis() *
|
||||||
@ -213,7 +214,7 @@ void btKart::updateWheelTransformsWS(btWheelInfo& wheel,
|
|||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
btScalar btKart::rayCast(unsigned int index)
|
btScalar btKart::rayCast(unsigned int index, float fraction)
|
||||||
{
|
{
|
||||||
btWheelInfo &wheel = m_wheelInfo[index];
|
btWheelInfo &wheel = m_wheelInfo[index];
|
||||||
|
|
||||||
@ -229,7 +230,7 @@ btScalar btKart::rayCast(unsigned int index)
|
|||||||
m_chassisBody->getBroadphaseHandle()->m_collisionFilterGroup = 0;
|
m_chassisBody->getBroadphaseHandle()->m_collisionFilterGroup = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
updateWheelTransformsWS( wheel,false);
|
updateWheelTransformsWS( wheel,false, fraction);
|
||||||
|
|
||||||
btScalar max_susp_len = wheel.getSuspensionRestLength()
|
btScalar max_susp_len = wheel.getSuspensionRestLength()
|
||||||
+ wheel.m_maxSuspensionTravel;
|
+ wheel.m_maxSuspensionTravel;
|
||||||
@ -391,6 +392,16 @@ void btKart::updateVehicle( btScalar step )
|
|||||||
rayCast( i);
|
rayCast( i);
|
||||||
if(m_wheelInfo[i].m_raycastInfo.m_isInContact)
|
if(m_wheelInfo[i].m_raycastInfo.m_isInContact)
|
||||||
m_num_wheels_on_ground++;
|
m_num_wheels_on_ground++;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// If the original raycast did not hit the ground,
|
||||||
|
// try a little bit (5%) closer to the centre of the chassis.
|
||||||
|
// Some tracks have very minor gaps that would otherwise
|
||||||
|
// trigger odd physical behaviour.
|
||||||
|
rayCast(i, 0.95f);
|
||||||
|
if (m_wheelInfo[i].m_raycastInfo.m_isInContact)
|
||||||
|
m_num_wheels_on_ground++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test if the kart is falling so fast
|
// Test if the kart is falling so fast
|
||||||
@ -465,33 +476,6 @@ void btKart::updateVehicle( btScalar step )
|
|||||||
m_chassisBody->applyTorqueImpulse(axis * m_kart->getKartProperties()->getStabilitySmoothFlyingImpulse());
|
m_chassisBody->applyTorqueImpulse(axis * m_kart->getKartProperties()->getStabilitySmoothFlyingImpulse());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Work around: make sure that either both wheels on one axis
|
|
||||||
// are on ground, or none of them. This avoids the problem of
|
|
||||||
// the kart suddenly getting additional angular velocity because
|
|
||||||
// e.g. only one rear wheel is on the ground and then the kart
|
|
||||||
// rotates very abruptly.
|
|
||||||
for(int i=0; i<m_wheelInfo.size(); i+=2)
|
|
||||||
{
|
|
||||||
if( m_wheelInfo[i ].m_raycastInfo.m_isInContact !=
|
|
||||||
m_wheelInfo[i+1].m_raycastInfo.m_isInContact)
|
|
||||||
{
|
|
||||||
int wheel_air_index = i;
|
|
||||||
int wheel_ground_index = i+1;
|
|
||||||
|
|
||||||
if (m_wheelInfo[i].m_raycastInfo.m_isInContact)
|
|
||||||
{
|
|
||||||
wheel_air_index = i+1;
|
|
||||||
wheel_ground_index = i;
|
|
||||||
}
|
|
||||||
|
|
||||||
btWheelInfo& wheel_air = m_wheelInfo[wheel_air_index];
|
|
||||||
btWheelInfo& wheel_ground = m_wheelInfo[wheel_ground_index];
|
|
||||||
|
|
||||||
wheel_air.m_raycastInfo = wheel_ground.m_raycastInfo;
|
|
||||||
}
|
|
||||||
} // for i=0; i<m_wheelInfo.size(); i+=2
|
|
||||||
|
|
||||||
|
|
||||||
// Apply suspension forcen (i.e. upwards force)
|
// Apply suspension forcen (i.e. upwards force)
|
||||||
// --------------------------------------------
|
// --------------------------------------------
|
||||||
updateSuspension(step);
|
updateSuspension(step);
|
||||||
@ -520,28 +504,6 @@ void btKart::updateVehicle( btScalar step )
|
|||||||
// ------------------------------------
|
// ------------------------------------
|
||||||
updateFriction( step);
|
updateFriction( step);
|
||||||
|
|
||||||
for (int i=0;i<m_wheelInfo.size();i++)
|
|
||||||
{
|
|
||||||
btWheelInfo& wheel = m_wheelInfo[i];
|
|
||||||
//btVector3 relpos = wheel.m_raycastInfo.m_hardPointWS
|
|
||||||
// - getRigidBody()->getCenterOfMassPosition();
|
|
||||||
//btVector3 vel = getRigidBody()->getVelocityInLocalPoint(relpos);
|
|
||||||
|
|
||||||
if (wheel.m_raycastInfo.m_isInContact)
|
|
||||||
{
|
|
||||||
const btTransform& chassisWorldTransform =
|
|
||||||
getChassisWorldTransform();
|
|
||||||
|
|
||||||
btVector3 fwd (
|
|
||||||
chassisWorldTransform.getBasis()[0][m_indexForwardAxis],
|
|
||||||
chassisWorldTransform.getBasis()[1][m_indexForwardAxis],
|
|
||||||
chassisWorldTransform.getBasis()[2][m_indexForwardAxis]);
|
|
||||||
|
|
||||||
btScalar proj = fwd.dot(wheel.m_raycastInfo.m_contactNormalWS);
|
|
||||||
fwd -= wheel.m_raycastInfo.m_contactNormalWS * proj;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// If configured, add a force to keep karts on the track
|
// If configured, add a force to keep karts on the track
|
||||||
// -----------------------------------------------------
|
// -----------------------------------------------------
|
||||||
float dif = m_kart->getKartProperties()->getStabilityDownwardImpulseFactor();
|
float dif = m_kart->getKartProperties()->getStabilityDownwardImpulseFactor();
|
||||||
@ -669,13 +631,6 @@ void btKart::updateSuspension(btScalar deltaTime)
|
|||||||
btScalar length_diff = (susp_length - current_length);
|
btScalar length_diff = (susp_length - current_length);
|
||||||
if(m_kart->getKartProperties()->getSuspensionExpSpringResponse())
|
if(m_kart->getKartProperties()->getSuspensionExpSpringResponse())
|
||||||
length_diff *= fabsf(length_diff)/susp_length;
|
length_diff *= fabsf(length_diff)/susp_length;
|
||||||
float f = (1.0f + fabsf(length_diff) / susp_length);
|
|
||||||
// Scale the length diff. This results that in uphill sections, when
|
|
||||||
// the suspension is more compressed (i.e. length is bigger), more
|
|
||||||
// force is used, which makes it much less likely for the kart to hit
|
|
||||||
// the terrain, while when driving on flat terrain (length small),
|
|
||||||
// there is hardly any difference
|
|
||||||
length_diff *= f*f;
|
|
||||||
force = wheel_info.m_suspensionStiffness * length_diff
|
force = wheel_info.m_suspensionStiffness * length_diff
|
||||||
* wheel_info.m_clippedInvContactDotSuspension;
|
* wheel_info.m_clippedInvContactDotSuspension;
|
||||||
|
|
||||||
|
@ -150,7 +150,7 @@ public:
|
|||||||
void reset();
|
void reset();
|
||||||
void debugDraw(btIDebugDraw* debugDrawer);
|
void debugDraw(btIDebugDraw* debugDrawer);
|
||||||
const btTransform& getChassisWorldTransform() const;
|
const btTransform& getChassisWorldTransform() const;
|
||||||
btScalar rayCast(unsigned int index);
|
btScalar rayCast(unsigned int index, float fraction=1.0f);
|
||||||
virtual void updateVehicle(btScalar step);
|
virtual void updateVehicle(btScalar step);
|
||||||
void resetSuspension();
|
void resetSuspension();
|
||||||
btScalar getSteeringValue(int wheel) const;
|
btScalar getSteeringValue(int wheel) const;
|
||||||
@ -169,7 +169,8 @@ public:
|
|||||||
const btWheelInfo& getWheelInfo(int index) const;
|
const btWheelInfo& getWheelInfo(int index) const;
|
||||||
btWheelInfo& getWheelInfo(int index);
|
btWheelInfo& getWheelInfo(int index);
|
||||||
void updateWheelTransformsWS(btWheelInfo& wheel,
|
void updateWheelTransformsWS(btWheelInfo& wheel,
|
||||||
bool interpolatedTransform=true);
|
bool interpolatedTransform=true,
|
||||||
|
float fraction = 1.0f);
|
||||||
void setAllBrakes(btScalar brake);
|
void setAllBrakes(btScalar brake);
|
||||||
void updateSuspension(btScalar deltaTime);
|
void updateSuspension(btScalar deltaTime);
|
||||||
virtual void updateFriction(btScalar timeStep);
|
virtual void updateFriction(btScalar timeStep);
|
||||||
|
@ -174,10 +174,13 @@ void TriangleMesh::createCollisionShape(bool create_collision_object, const char
|
|||||||
* removed and all objects together with the track is converted again into
|
* removed and all objects together with the track is converted again into
|
||||||
* a single rigid body. This avoids using irrlicht (or the graphics engine)
|
* a single rigid body. This avoids using irrlicht (or the graphics engine)
|
||||||
* for height of terrain detection).
|
* for height of terrain detection).
|
||||||
* @param serializedBhv if non-NULL, the bhv is deserialized instead of
|
* \param friction Friction to be used for this TriangleMesh.
|
||||||
|
* \param flags Additional collision flags (default 0).
|
||||||
|
* \param serializedBhv if non-NULL, the bhv is deserialized instead of
|
||||||
* being calculated on the fly
|
* being calculated on the fly
|
||||||
*/
|
*/
|
||||||
void TriangleMesh::createPhysicalBody(btCollisionObject::CollisionFlags flags,
|
void TriangleMesh::createPhysicalBody(float friction,
|
||||||
|
btCollisionObject::CollisionFlags flags,
|
||||||
const char* serializedBhv)
|
const char* serializedBhv)
|
||||||
{
|
{
|
||||||
// We need the collision shape, but not the collision object (since
|
// We need the collision shape, but not the collision object (since
|
||||||
@ -189,6 +192,8 @@ void TriangleMesh::createPhysicalBody(btCollisionObject::CollisionFlags flags,
|
|||||||
btRigidBody::btRigidBodyConstructionInfo info(0.0f, m_motion_state,
|
btRigidBody::btRigidBodyConstructionInfo info(0.0f, m_motion_state,
|
||||||
m_collision_shape);
|
m_collision_shape);
|
||||||
info.m_restitution = 0.8f;
|
info.m_restitution = 0.8f;
|
||||||
|
info.m_friction = friction;
|
||||||
|
|
||||||
m_body=new btRigidBody(info);
|
m_body=new btRigidBody(info);
|
||||||
Physics::getInstance()->addBody(m_body);
|
Physics::getInstance()->addBody(m_body);
|
||||||
|
|
||||||
|
@ -57,7 +57,8 @@ public:
|
|||||||
const btVector3 &n2, const btVector3 &n3,
|
const btVector3 &n2, const btVector3 &n3,
|
||||||
const Material* m);
|
const Material* m);
|
||||||
void createCollisionShape(bool create_collision_object=true, const char* serialized_bhv=NULL);
|
void createCollisionShape(bool create_collision_object=true, const char* serialized_bhv=NULL);
|
||||||
void createPhysicalBody(btCollisionObject::CollisionFlags flags=
|
void createPhysicalBody(float friction,
|
||||||
|
btCollisionObject::CollisionFlags flags=
|
||||||
(btCollisionObject::CollisionFlags)0,
|
(btCollisionObject::CollisionFlags)0,
|
||||||
const char* serializedBhv = NULL);
|
const char* serializedBhv = NULL);
|
||||||
void removeAll();
|
void removeAll();
|
||||||
|
@ -480,6 +480,7 @@ void Track::loadTrackInfo()
|
|||||||
m_fog_height_start = 0.0f;
|
m_fog_height_start = 0.0f;
|
||||||
m_fog_height_end = 100.0f;
|
m_fog_height_end = 100.0f;
|
||||||
m_gravity = 9.80665f;
|
m_gravity = 9.80665f;
|
||||||
|
m_friction = stk_config->m_default_track_friction;
|
||||||
m_smooth_normals = false;
|
m_smooth_normals = false;
|
||||||
m_godrays = false;
|
m_godrays = false;
|
||||||
m_godrays_opacity = 1.0f;
|
m_godrays_opacity = 1.0f;
|
||||||
@ -514,6 +515,7 @@ void Track::loadTrackInfo()
|
|||||||
getMusicInformation(filenames, m_music);
|
getMusicInformation(filenames, m_music);
|
||||||
root->get("screenshot", &m_screenshot);
|
root->get("screenshot", &m_screenshot);
|
||||||
root->get("gravity", &m_gravity);
|
root->get("gravity", &m_gravity);
|
||||||
|
root->get("friction", &m_friction);
|
||||||
root->get("soccer", &m_is_soccer);
|
root->get("soccer", &m_is_soccer);
|
||||||
root->get("arena", &m_is_arena);
|
root->get("arena", &m_is_arena);
|
||||||
root->get("max-arena-players", &m_max_arena_players);
|
root->get("max-arena-players", &m_max_arena_players);
|
||||||
@ -836,7 +838,7 @@ void Track::createPhysicsModel(unsigned int main_track_count)
|
|||||||
{
|
{
|
||||||
convertTrackToBullet(m_all_nodes[i]);
|
convertTrackToBullet(m_all_nodes[i]);
|
||||||
}
|
}
|
||||||
m_track_mesh->createPhysicalBody();
|
m_track_mesh->createPhysicalBody(m_friction);
|
||||||
m_gfx_effect_mesh->createCollisionShape();
|
m_gfx_effect_mesh->createCollisionShape();
|
||||||
} // createPhysicsModel
|
} // createPhysicsModel
|
||||||
|
|
||||||
|
@ -104,7 +104,12 @@ private:
|
|||||||
unsigned int m_magic_number;
|
unsigned int m_magic_number;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Gravity to be used for this track. */
|
||||||
float m_gravity;
|
float m_gravity;
|
||||||
|
|
||||||
|
/** Friction to be used for the track. */
|
||||||
|
float m_friction;
|
||||||
|
|
||||||
std::string m_ident;
|
std::string m_ident;
|
||||||
std::string m_screenshot;
|
std::string m_screenshot;
|
||||||
bool m_is_day;
|
bool m_is_day;
|
||||||
|
@ -28,7 +28,7 @@ import sys
|
|||||||
# Each line contains a topic and the attributes of that topic.
|
# Each line contains a topic and the attributes of that topic.
|
||||||
# This model is used for the xml file and to access the kart properties in the code.
|
# This model is used for the xml file and to access the kart properties in the code.
|
||||||
characteristics = """Suspension: stiffness, rest, travel, expSpringResponse(bool), maxForce
|
characteristics = """Suspension: stiffness, rest, travel, expSpringResponse(bool), maxForce
|
||||||
Stability: rollInfluence, chassisLinearDamping, chassisAngularDamping, downwardImpulseFactor, trackConnectionAccel, smoothFlyingImpulse
|
Stability: rollInfluence, chassisLinearDamping, chassisAngularDamping, downwardImpulseFactor, trackConnectionAccel, angularFactor(std::vector<float>/floatVector), smoothFlyingImpulse
|
||||||
Turn: radius(InterpolationArray), timeResetSteer, timeFullSteer(InterpolationArray)
|
Turn: radius(InterpolationArray), timeResetSteer, timeFullSteer(InterpolationArray)
|
||||||
Engine: power, maxSpeed, brakeFactor, brakeTimeIncrease, maxSpeedReverseRatio
|
Engine: power, maxSpeed, brakeFactor, brakeTimeIncrease, maxSpeedReverseRatio
|
||||||
Gear: switchRatio(std::vector<float>/floatVector), powerIncrease(std::vector<float>/floatVector)
|
Gear: switchRatio(std::vector<float>/floatVector), powerIncrease(std::vector<float>/floatVector)
|
||||||
@ -39,6 +39,7 @@ Jump: animationTime
|
|||||||
Lean: max, speed
|
Lean: max, speed
|
||||||
Anvil: duration, weight, speedFactor
|
Anvil: duration, weight, speedFactor
|
||||||
Parachute: friction, duration, durationOther, durationRankMult, durationSpeedMult, lboundFraction, uboundFraction, maxSpeed
|
Parachute: friction, duration, durationOther, durationRankMult, durationSpeedMult, lboundFraction, uboundFraction, maxSpeed
|
||||||
|
Friction: kartFriction
|
||||||
Bubblegum: duration, speedFraction, torque, fadeInTime, shieldDuration
|
Bubblegum: duration, speedFraction, torque, fadeInTime, shieldDuration
|
||||||
Zipper: duration, force, speedGain, maxSpeedIncrease, fadeOutTime
|
Zipper: duration, force, speedGain, maxSpeedIncrease, fadeOutTime
|
||||||
Swatter: duration, distance, squashDuration, squashSlowdown
|
Swatter: duration, distance, squashDuration, squashSlowdown
|
||||||
@ -245,7 +246,7 @@ functions = {
|
|||||||
"getName": (createGetName, "Implement the getName function", "karts/abstract_characteristic.cpp"),
|
"getName": (createGetName, "Implement the getName function", "karts/abstract_characteristic.cpp"),
|
||||||
"kpdefs": (createKpDefs, "Create the header function definitions for the getters", "karts/kart_properties.hpp"),
|
"kpdefs": (createKpDefs, "Create the header function definitions for the getters", "karts/kart_properties.hpp"),
|
||||||
"kpgetter": (createKpGetter, "Implement the getters", "karts/kart_properties.cpp"),
|
"kpgetter": (createKpGetter, "Implement the getters", "karts/kart_properties.cpp"),
|
||||||
"loadXml": (createLoadXml, "Code to load the characteristics from an xml file", "karts/xml_characteristic.hpp"),
|
"loadXml": (createLoadXml, "Code to load the characteristics from an xml file", "karts/xml_characteristic.cpp"),
|
||||||
}
|
}
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
Loading…
Reference in New Issue
Block a user