Removed optional setting for random-wheel rotation.

This commit is contained in:
hiker
2015-07-14 17:36:03 +10:00
parent 9f687fd6cf
commit 210e4fb4ec
5 changed files with 10 additions and 32 deletions

View File

@@ -2572,10 +2572,6 @@ void Kart::updateGraphics(float dt, const Vec3& offset_xyz,
}
}
// m_speed*dt is the distance the kart has moved, which determines
// how much the wheels need to rotate.
m_kart_model->update(dt, m_speed*dt, getSteerPercent(), m_speed);
// If the kart is leaning, part of the kart might end up 'in' the track.
// To avoid this, raise the kart enough to offset the leaning.
float lean_height = tan(fabsf(m_current_lean)) * getKartWidth()*0.5f;
@@ -2637,6 +2633,10 @@ void Kart::updateGraphics(float dt, const Vec3& offset_xyz,
Moveable::updateGraphics(dt, center_shift,
btQuaternion(heading, 0, m_current_lean));
// m_speed*dt is the distance the kart has moved, which determines
// how much the wheels need to rotate.
m_kart_model->update(dt, m_speed*dt, getSteerPercent(), m_speed);
#ifdef XX
// cheap wheelie effect
if (m_controls.m_nitro)

View File

@@ -656,12 +656,11 @@ void KartModel::reset()
{
for (unsigned int i = 0; i < 4; i++)
{
m_wheel_rotation[i] = btScalar(rand() % 360);
m_wheel_rotation_dt[i] = 0.0f;
core::vector3df wheel_rotation(0, 0, 0);
if (m_wheel_node[i])
m_wheel_node[i]->setRotation(wheel_rotation);
{
core::vector3df rotation(btScalar(rand() % 360)*DEGREE_TO_RAD, 0, 0);
m_wheel_node[i]->setRotation(rotation);
}
}
update(0.0f, 0.0f, 0.0f, 0.0f);
@@ -787,7 +786,7 @@ void KartModel::setDefaultSuspension()
/** Rotates and turns the wheels appropriately, and adjust for suspension
+ updates the speed-weighted objects' animations.
* \param dt time since last frame
* \param rotation_dt How far the wheels have rotated since last time.
* \param distance How far the wheels have rotated since last time.
* \param steer The actual steer settings.
* \param suspension Suspension height for all four wheels.
* \param speed The speed of the kart in meters/sec, used for the
@@ -811,11 +810,6 @@ void KartModel::update(float dt, float distance, float steer, float speed)
}
}
#endif
//m_wheel_rotation gives the rotation around the X-axis
m_wheel_rotation_dt[i] = distance / m_wheel_graphics_radius[i];
m_wheel_rotation[i] += m_wheel_rotation_dt[i];
m_wheel_rotation[i] = fmodf(m_wheel_rotation[i], 2 * M_PI);
core::vector3df pos = m_wheel_graphics_position[i].toIrrVector();
const btWheelInfo &wi = m_kart->getVehicle()->getWheelInfo(i);
@@ -824,7 +818,7 @@ void KartModel::update(float dt, float distance, float steer, float speed)
// Now calculate the new rotation: (old + change) mod 360
float new_rotation = m_wheel_node[i]->getRotation().X
+ m_wheel_rotation_dt[i] * RAD_TO_DEGREE;
+ distance / m_wheel_graphics_radius[i] * RAD_TO_DEGREE;
new_rotation = fmodf(new_rotation, 360);
core::vector3df wheel_rotation(new_rotation, 0, 0);
// Only apply steer to first 2 wheels.

View File

@@ -185,14 +185,6 @@ private:
of wheels in bullet is too large and looks strange). 1=no change, 2=half the amplitude */
float m_dampen_suspension_amplitude[4];
/** Rotation compared to the start position, same for all wheels */
float m_wheel_rotation[4];
/** Rotation change in the last time delta, same for all wheels */
float m_wheel_rotation_dt[4];
/** Which animation is currently being played. This is used to overwrite
* the default steering animations while being in race. If this is set
* to AF_DEFAULT the default steering animation is shown. */

View File

@@ -111,7 +111,6 @@ KartProperties::KartProperties(const std::string &filename)
m_shape = 32; // close enough to a circle.
m_engine_sfx_type = "engine_small";
m_kart_model = NULL;
m_has_rand_wheels = false;
m_nitro_min_consumption = 0.53f;
// The default constructor for stk_config uses filename=""
if (filename != "")
@@ -339,8 +338,6 @@ void KartProperties::getAllData(const XMLNode * root)
root->get("groups", &m_groups );
root->get("random-wheel-rot", &m_has_rand_wheels );
root->get("shadow-scale", &m_shadow_scale );
root->get("shadow-x-offset", &m_shadow_x_offset );
root->get("shadow-z-offset", &m_shadow_z_offset );

View File

@@ -211,8 +211,6 @@ private:
/** A hard flag that moves the graphical chassis higher if it's insde
* the track. Might cause stuttering. */
bool m_prevent_chassis_in_terrain;
/** If the kart is supposed to have random wheel rotation at start. */
bool m_has_rand_wheels;
/** Max. length of plunger rubber band. */
float m_rubber_band_max_length;
/** Force of an attached rubber band. */
@@ -921,9 +919,6 @@ public:
* animation. */
float getJumpAnimationTime() const { return m_jump_animation_time; }
// ------------------------------------------------------------------------
/** Returns true if wheels should have random rotation at start. */
bool hasRandomWheels() const { return m_has_rand_wheels; }
// ------------------------------------------------------------------------
/** Returns minimum time during which nitro is consumed when pressing nitro
* key, to prevent using nitro in very short bursts
*/