Fix suspension to some more realistic values.
This commit is contained in:
parent
15cccf9301
commit
1179ebf4e9
@ -113,8 +113,8 @@ KartModel::KartModel(bool is_master)
|
|||||||
|
|
||||||
// default value for kart suspensions. move to config file later
|
// default value for kart suspensions. move to config file later
|
||||||
// if we find each kart needs custom values
|
// if we find each kart needs custom values
|
||||||
m_min_suspension[i] = -0.59f;
|
m_min_suspension[i] = -0.07;
|
||||||
m_max_suspension[i] = 0.59f;
|
m_max_suspension[i] = 0.20f;
|
||||||
m_dampen_suspension_amplitude[i] = 2.5f;
|
m_dampen_suspension_amplitude[i] = 2.5f;
|
||||||
}
|
}
|
||||||
m_wheel_filename[0] = "";
|
m_wheel_filename[0] = "";
|
||||||
@ -782,15 +782,16 @@ void KartModel::update(float dt, float rotation_dt, float steer, float speed)
|
|||||||
m_wheel_node[i]->setVisible(wi.m_raycastInfo.m_isInContact);
|
m_wheel_node[i]->setVisible(wi.m_raycastInfo.m_isInContact);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
float rel_suspension = m_default_physics_suspension[i]
|
float rel_suspension = wi.m_raycastInfo.m_suspensionLength
|
||||||
- wi.m_raycastInfo.m_suspensionLength;
|
- m_default_physics_suspension[i];
|
||||||
|
// If the suspension is too compressed
|
||||||
if(rel_suspension< m_min_suspension[i])
|
if(rel_suspension< m_min_suspension[i])
|
||||||
rel_suspension = m_min_suspension[i];
|
rel_suspension = m_min_suspension[i];
|
||||||
else if(rel_suspension > m_max_suspension[i])
|
else if(rel_suspension > m_max_suspension[i])
|
||||||
rel_suspension = m_max_suspension[i];
|
rel_suspension = m_max_suspension[i];
|
||||||
|
|
||||||
core::vector3df pos = m_wheel_graphics_position[i].toIrrVector();
|
core::vector3df pos = m_wheel_graphics_position[i].toIrrVector();
|
||||||
pos.Y += rel_suspension;
|
pos.Y -= rel_suspension;
|
||||||
|
|
||||||
m_wheel_node[i]->setPosition(pos);
|
m_wheel_node[i]->setPosition(pos);
|
||||||
|
|
||||||
|
@ -172,12 +172,13 @@ private:
|
|||||||
/** Length of the physics suspension when the kart is at rest. */
|
/** Length of the physics suspension when the kart is at rest. */
|
||||||
float m_default_physics_suspension[4];
|
float m_default_physics_suspension[4];
|
||||||
|
|
||||||
/** Minimum suspension length. If the displayed suspension is
|
/** Minimum suspension length (i.e. most compressed). If the displayed
|
||||||
* shorter than this, the wheel would look wrong. */
|
* suspension is shorter than this, the wheel would look wrong. */
|
||||||
float m_min_suspension[4];
|
float m_min_suspension[4];
|
||||||
|
|
||||||
/** Maximum suspension length. If the displayed suspension is
|
/** Maximum suspension length (i.e. most extended). If the displayed
|
||||||
* any longer, the wheel would look too far away from the chassis. */
|
* suspension is any longer, the wheel would look too far away from the
|
||||||
|
* chassis. */
|
||||||
float m_max_suspension[4];
|
float m_max_suspension[4];
|
||||||
|
|
||||||
/** value used to divide the visual movement of wheels (because the actual movement
|
/** value used to divide the visual movement of wheels (because the actual movement
|
||||||
|
Loading…
Reference in New Issue
Block a user