Removed unused kart properties settings.

This commit is contained in:
hiker 2015-07-18 12:24:56 +10:00
parent 0f09649aa8
commit 802d4897fe
5 changed files with 72 additions and 42 deletions

View File

@ -154,15 +154,6 @@
otherwise obstricts too much of the view. --> otherwise obstricts too much of the view. -->
<camera distance="1.0" forward-up-angle="15" <camera distance="1.0" forward-up-angle="15"
backward-up-angle="5"/> backward-up-angle="5"/>
<!-- Options to affect the graphical chassis:
y-offset: Additional offset to move graphical chassis with regards
to the physics, used to reduce frequencey of graphical
chassis in terrain.
prevent-chassis-in-terrain: a hard flag to prevent nearly all instances
of chassis in terrain. Can (atm) cause some stuttering. -->
<graphics y-offset="0.0"
prevent-chassis-in-terrain="true"
/>
<!-- Jump animation related values: <!-- Jump animation related values:
animation-time: only if the estimated time for a jump is larger animation-time: only if the estimated time for a jump is larger

View File

@ -563,14 +563,6 @@ bool KartModel::loadModels(const KartProperties &kart_properties)
} }
} }
float y_off = kart_properties.getGraphicalYOffset();
if(y_off!=0)
{
for (unsigned int i = 0; i < 4; i++)
m_wheel_graphics_position[i].setY(
m_wheel_graphics_position[i].getY() - y_off);
}
// Load the wheel models. This can't be done early, since the default // Load the wheel models. This can't be done early, since the default
// values for the graphical position must be defined, which in turn // values for the graphical position must be defined, which in turn
// depend on the size of the model. // depend on the size of the model.

View File

@ -93,7 +93,6 @@ KartProperties::KartProperties(const std::string &filename)
m_bubblegum_fade_in_time = m_bubblegum_speed_fraction = m_bubblegum_fade_in_time = m_bubblegum_speed_fraction =
m_bubblegum_time = m_bubblegum_torque = m_jump_animation_time = m_bubblegum_time = m_bubblegum_torque = m_jump_animation_time =
m_smooth_flying_impulse = m_physical_wheel_position = m_smooth_flying_impulse = m_physical_wheel_position =
m_graphical_y_offset =
UNDEFINED; UNDEFINED;
m_engine_power.resize(RaceManager::DIFFICULTY_COUNT, UNDEFINED); m_engine_power.resize(RaceManager::DIFFICULTY_COUNT, UNDEFINED);
@ -105,7 +104,6 @@ KartProperties::KartProperties(const std::string &filename)
m_gravity_center_shift = Vec3(UNDEFINED); m_gravity_center_shift = Vec3(UNDEFINED);
m_bevel_factor = Vec3(UNDEFINED); m_bevel_factor = Vec3(UNDEFINED);
m_exp_spring_response = false; m_exp_spring_response = false;
m_prevent_chassis_in_terrain = false;
m_version = 0; m_version = 0;
m_color = video::SColor(255, 0, 0, 0); m_color = video::SColor(255, 0, 0, 0);
m_shape = 32; // close enough to a circle. m_shape = 32; // close enough to a circle.
@ -632,13 +630,6 @@ void KartProperties::getAllData(const XMLNode * root)
startup_node->get("boost", &m_startup_boost); startup_node->get("boost", &m_startup_boost);
} }
if(const XMLNode *graphics_node = root->getNode("graphics"))
{
graphics_node->get("y-offset", &m_graphical_y_offset);
graphics_node->get("prevent-chassis-in-terrain",
&m_prevent_chassis_in_terrain);
}
if(m_kart_model) if(m_kart_model)
m_kart_model->loadInfo(*root); m_kart_model->loadInfo(*root);
} // getAllData } // getAllData
@ -758,7 +749,7 @@ void KartProperties::checkAllSet(const std::string &filename)
CHECK_NEG(m_explosion_invulnerability_time, CHECK_NEG(m_explosion_invulnerability_time,
"explosion invulnerability-time"); "explosion invulnerability-time");
CHECK_NEG(m_explosion_radius, "explosion radius" ); CHECK_NEG(m_explosion_radius, "explosion radius" );
CHECK_NEG(m_graphical_y_offset, "graphics y-offset" );
for(unsigned int i=RaceManager::DIFFICULTY_FIRST; for(unsigned int i=RaceManager::DIFFICULTY_FIRST;
i<=RaceManager::DIFFICULTY_LAST; i++) i<=RaceManager::DIFFICULTY_LAST; i++)
{ {

View File

@ -208,9 +208,6 @@ private:
* chassis. Useful for karts that don't have enough space for suspension * chassis. Useful for karts that don't have enough space for suspension
* compression. */ * compression. */
float m_graphical_y_offset; float m_graphical_y_offset;
/** A hard flag that moves the graphical chassis higher if it's insde
* the track. Might cause stuttering. */
bool m_prevent_chassis_in_terrain;
/** Max. length of plunger rubber band. */ /** Max. length of plunger rubber band. */
float m_rubber_band_max_length; float m_rubber_band_max_length;
/** Force of an attached rubber band. */ /** Force of an attached rubber band. */
@ -568,18 +565,6 @@ public:
/** Returns roll influence. */ /** Returns roll influence. */
float getRollInfluence () const {return m_roll_influence; } float getRollInfluence () const {return m_roll_influence; }
// ------------------------------------------------------------------------
/** Return the additional Y offset added to the y position of the graphical
* chassis. Useful for karts that don't have enough space for suspension
* compression. */
float getGraphicalYOffset() const {return m_graphical_y_offset; }
// ------------------------------------------------------------------------
/** A hard flag that moves the graphical chassis higher if it's insde
* the track. Might cause stuttering. */
bool getPreventChassisInTerrain() const
{
return m_prevent_chassis_in_terrain;
} // getPreventChassisInTerrain
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
/** Returns parameters for the speed-weighted objects */ /** Returns parameters for the speed-weighted objects */
const SpeedWeightedObject::Properties& getSpeedWeightedObjectProperties() const const SpeedWeightedObject::Properties& getSpeedWeightedObjectProperties() const

71
src/karts/patch Normal file
View File

@ -0,0 +1,71 @@
diff --git a/src/karts/kart.cpp b/src/karts/kart.cpp
index de14bbe..47bbee9 100644
--- a/src/karts/kart.cpp
+++ b/src/karts/kart.cpp
@@ -2476,11 +2476,12 @@ void Kart::kartIsInRestNow()
for(int i=0; i<m_vehicle->getNumWheels(); i++)
{
const btWheelInfo &wi = m_vehicle->getWheelInfo(i);
- f += wi.m_chassisConnectionPointCS.getY()
- - wi.m_raycastInfo.m_suspensionLength - wi.m_wheelsRadius;
+ f += wi.m_raycastInfo.m_suspensionLength;
}
+ m_terrain_info->update(getTrans());
m_graphical_y_offset = f/m_vehicle->getNumWheels()
+ getKartProperties()->getGraphicalYOffset();
+ m_graphical_y_offset = m_kart_model->getLowestPoint() - (getXYZ().getY() - m_terrain_info->getHoT());
m_kart_model->setDefaultSuspension();
} // kartIsInRestNow
@@ -2595,11 +2596,6 @@ void Kart::updateGraphics(float dt, const Vec3& offset_xyz,
} // for i<num_wheels
const btWheelInfo &w = getVehicle()->getWheelInfo(0);
- // Determine the shadow position from the terrain Y position. This
- // leaves the shadow on the ground even if the kart is jumping because
- // of skidding (shadows are disabled when wheel are not on the track).
- m_shadow->update(m_terrain_info->getHoT() - getXYZ().getY()
- -m_skidding->getGraphicalJumpOffset());
// Recompute the default average suspension length, see
// kartIsInRestNow() how to get from y-offset to susp. len.
float av_sus_len = -m_graphical_y_offset
@@ -2628,6 +2624,9 @@ void Kart::updateGraphics(float dt, const Vec3& offset_xyz,
+ lean_height
- m_kart_model->getLowestPoint());
+ center_shift.setY(m_skidding->getGraphicalJumpOffset()
+ + lean_height
+ +m_graphical_y_offset);
center_shift = getTrans().getBasis() * center_shift;
Moveable::updateGraphics(dt, center_shift,
@@ -2637,6 +2636,14 @@ void Kart::updateGraphics(float dt, const Vec3& offset_xyz,
// how much the wheels need to rotate.
m_kart_model->update(dt, m_speed*dt, getSteerPercent(), m_speed);
+ // Determine the shadow position from the terrain Y position. This
+ // leaves the shadow on the ground even if the kart is jumping because
+ // of skidding (shadows are disabled when wheel are not on the track).
+ m_shadow->update( m_terrain_info->getHoT() - getXYZ().getY()
+ - m_skidding->getGraphicalJumpOffset()
+ - m_graphical_y_offset
+ - m_kart_model->getLowestPoint());
+
#ifdef XX
// cheap wheelie effect
if (m_controls.m_nitro)
diff --git a/src/karts/kart_model.cpp b/src/karts/kart_model.cpp
index 65879d3..36b03b7 100644
--- a/src/karts/kart_model.cpp
+++ b/src/karts/kart_model.cpp
@@ -813,7 +813,9 @@ void KartModel::update(float dt, float distance, float steer, float speed)
core::vector3df pos = m_wheel_graphics_position[i].toIrrVector();
const btWheelInfo &wi = m_kart->getVehicle()->getWheelInfo(i);
- pos.Y = -wi.m_raycastInfo.m_suspensionLength + m_wheel_graphics_radius[i] + getLowestPoint();
+ pos.Y += m_default_physics_suspension[i]
+ - wi.m_raycastInfo.m_suspensionLength
+ - getLowestPoint();
m_wheel_node[i]->setPosition(pos);
// Now calculate the new rotation: (old + change) mod 360