ubode add position to pid control it stopped flying to prevent slow drifts

0.9.1.0-post-fixes
UbitUmarov 2019-01-31 17:25:18 +00:00
parent 76b777b1fb
commit 9046e5cb9d
1 changed files with 31 additions and 27 deletions

View File

@ -1435,9 +1435,10 @@ namespace OpenSim.Region.PhysicsModule.ubOde
if(!m_freemove)
{
// if velocity is zero, use position control; otherwise, velocity control
if(tviszero && m_iscolliding && !m_flying)
if(tviszero)
{
if(m_iscolliding || m_flying)
{
// keep track of where we stopped. No more slippin' & slidin'
if (!_zeroFlag)
@ -1458,14 +1459,17 @@ namespace OpenSim.Region.PhysicsModule.ubOde
vec.Z += -vel.Z * PID_D + (_zeroPosition.Z - localpos.Z) * PID_P;
else
vec.Z += (-vel.Z * PID_D + (_zeroPosition.Z - localpos.Z) * PID_P) * 0.2f;
/*
if (flying)
}
}
else
{
vec.Z += -vel.Z * PID_D + (_zeroPosition.Z - localpos.Z) * PID_P;
_zeroFlag = false;
vec.X += (ctz.X - vel.X) * PID_D * 0.833f;
vec.Y += (ctz.Y - vel.Y) * PID_D * 0.833f;
// hack for breaking on fall
if (ctz.Z == -9999f)
vec.Z += -vel.Z * PID_D - m_parent_scene.gravityz * m_mass;
}
*/
}
//PidStatus = true;
}
else
{