ubode add position to pid control it stopped flying to prevent slow drifts
parent
76b777b1fb
commit
9046e5cb9d
|
@ -1435,12 +1435,13 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
|
|
||||||
if(!m_freemove)
|
if(!m_freemove)
|
||||||
{
|
{
|
||||||
|
|
||||||
// if velocity is zero, use position control; otherwise, velocity control
|
// 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'
|
// keep track of where we stopped. No more slippin' & slidin'
|
||||||
if(!_zeroFlag)
|
if (!_zeroFlag)
|
||||||
{
|
{
|
||||||
_zeroFlag = true;
|
_zeroFlag = true;
|
||||||
_zeroPosition = localpos;
|
_zeroPosition = localpos;
|
||||||
|
@ -1458,14 +1459,17 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
vec.Z += -vel.Z * PID_D + (_zeroPosition.Z - localpos.Z) * PID_P;
|
vec.Z += -vel.Z * PID_D + (_zeroPosition.Z - localpos.Z) * PID_P;
|
||||||
else
|
else
|
||||||
vec.Z += (-vel.Z * PID_D + (_zeroPosition.Z - localpos.Z) * PID_P) * 0.2f;
|
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
|
else
|
||||||
{
|
{
|
||||||
|
@ -1539,7 +1543,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
vec.X += (ctz.X - vel.X) * PID_D * 0.833f;
|
vec.X += (ctz.X - vel.X) * PID_D * 0.833f;
|
||||||
vec.Y += (ctz.Y - vel.Y) * PID_D * 0.833f;
|
vec.Y += (ctz.Y - vel.Y) * PID_D * 0.833f;
|
||||||
// hack for breaking on fall
|
// hack for breaking on fall
|
||||||
if(ctz.Z == -9999f)
|
if (ctz.Z == -9999f)
|
||||||
vec.Z += -vel.Z * PID_D - m_parent_scene.gravityz * m_mass;
|
vec.Z += -vel.Z * PID_D - m_parent_scene.gravityz * m_mass;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue