refactor: slightly adjust some code in ODECharacter.Move() to eliminate a condition check without changing the logic
parent
ad3ce54aca
commit
19bd27071a
|
@ -890,7 +890,14 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
// vec, _target_velocity, movementdivisor, vel);
|
// vec, _target_velocity, movementdivisor, vel);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_iscolliding && !flying && _target_velocity.Z > 0.0f)
|
if (flying)
|
||||||
|
{
|
||||||
|
// This also acts as anti-gravity so that we hover when flying rather than fall.
|
||||||
|
vec.Z = (_target_velocity.Z - vel.Z) * (PID_D);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (m_iscolliding && _target_velocity.Z > 0.0f)
|
||||||
{
|
{
|
||||||
// We're colliding with something and we're not flying but we're moving
|
// We're colliding with something and we're not flying but we're moving
|
||||||
// This means we're walking or running.
|
// This means we're walking or running.
|
||||||
|
@ -899,19 +906,13 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
vec.X = ((_target_velocity.X - vel.X) / 1.2f) * PID_D;
|
vec.X = ((_target_velocity.X - vel.X) / 1.2f) * PID_D;
|
||||||
vec.Y = ((_target_velocity.Y - vel.Y) / 1.2f) * PID_D;
|
vec.Y = ((_target_velocity.Y - vel.Y) / 1.2f) * PID_D;
|
||||||
}
|
}
|
||||||
else if (!m_iscolliding && !flying)
|
else if (!m_iscolliding)
|
||||||
{
|
{
|
||||||
// we're not colliding and we're not flying so that means we're falling!
|
// we're not colliding and we're not flying so that means we're falling!
|
||||||
// m_iscolliding includes collisions with the ground.
|
// m_iscolliding includes collisions with the ground.
|
||||||
|
|
||||||
vec.X = ((_target_velocity.X - vel.X) / 1.2f) * PID_D;
|
vec.X = ((_target_velocity.X - vel.X) / 1.2f) * PID_D;
|
||||||
vec.Y = ((_target_velocity.Y - vel.Y) / 1.2f) * PID_D;
|
vec.Y = ((_target_velocity.Y - vel.Y) / 1.2f) * PID_D;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flying)
|
|
||||||
{
|
|
||||||
// This also acts as anti-gravity so that we hover when flying rather than fall.
|
|
||||||
vec.Z = (_target_velocity.Z - vel.Z) * (PID_D);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue