BulletSim: reverse direction of hover correction. Removes problem with vehicles being orbited.

0.7.5-pf-bulletsim
Robert Adams 2012-11-29 08:03:30 -08:00
parent 2ccd4c1302
commit b8a7cbb9e9
1 changed files with 8 additions and 8 deletions

View File

@ -742,22 +742,22 @@ namespace OpenSim.Region.Physics.BulletSPlugin
else else
{ {
float verticalError = pos.Z - m_VhoverTargetHeight; float verticalError = pos.Z - m_VhoverTargetHeight;
// RA: where does the 50 come from? float verticalCorrectionVelocity = pTimestep * (verticalError / m_VhoverTimescale);
float verticalCorrectionVelocity = pTimestep * ((verticalError * 50.0f) / m_VhoverTimescale);
// Replace Vertical speed with correction figure if significant // TODO: implement m_VhoverEfficiency
if (verticalError > 0.01f) if (verticalError > 0.01f)
{ {
ret = new Vector3(0f, 0f, verticalCorrectionVelocity); // If error is positive (we're above the target height), push down
//KF: m_VhoverEfficiency is not yet implemented ret = new Vector3(0f, 0f, -verticalCorrectionVelocity);
} }
else if (verticalError < -0.01) else if (verticalError < -0.01)
{ {
ret = new Vector3(0f, 0f, -verticalCorrectionVelocity); ret = new Vector3(0f, 0f, verticalCorrectionVelocity);
} }
} }
VDetailLog("{0},MoveLinear,hover,pos={1},dir={2},height={3},target={4}", VDetailLog("{0},MoveLinear,hover,pos={1},ret={2},hoverTS={3},height={4},target={5}",
Prim.LocalID, pos, ret, m_VhoverHeight, m_VhoverTargetHeight); Prim.LocalID, pos, ret, m_VhoverTimescale, m_VhoverHeight, m_VhoverTargetHeight);
} }
return ret; return ret;