Stop calling the SP.ResetMoveToTarget() code if a target is not actually set

bulletsim
Justin Clark-Casey (justincc) 2011-08-03 23:59:13 +01:00
parent 31fb6b2d72
commit 6ab01b338f
1 changed files with 16 additions and 6 deletions

View File

@ -1430,6 +1430,7 @@ namespace OpenSim.Region.Framework.Scenes
// The fact that m_movementflag is a byte needs to be fixed // The fact that m_movementflag is a byte needs to be fixed
// it really should be a uint // it really should be a uint
// A DIR_CONTROL_FLAG occurs when the user is trying to move in a particular direction.
uint nudgehack = 250; uint nudgehack = 250;
foreach (Dir_ControlFlags DCF in DIR_CONTROL_FLAGS) foreach (Dir_ControlFlags DCF in DIR_CONTROL_FLAGS)
{ {
@ -1554,11 +1555,15 @@ namespace OpenSim.Region.Framework.Scenes
bool updated = false; bool updated = false;
//Paupaw:Do Proper PID for Autopilot here
if (reset) if (reset)
{ {
ResetMoveToTarget(); if (m_moveToPositionInProgress)
updated = true; {
ResetMoveToTarget();
updated = true;
}
return updated;
} }
// m_log.DebugFormat( // m_log.DebugFormat(
@ -1576,8 +1581,7 @@ namespace OpenSim.Region.Framework.Scenes
if (distanceToTarget <= 1) if (distanceToTarget <= 1)
{ {
// We are close enough to the target // We are close enough to the target
MoveToPositionTarget = Vector3.Zero; ResetMoveToTarget();
m_moveToPositionInProgress = false;
updated = true; updated = true;
} }
else else
@ -1660,6 +1664,10 @@ namespace OpenSim.Region.Framework.Scenes
updated = true; updated = true;
} }
// m_log.DebugFormat(
// "[SCENE PRESENCE]: HandleMoveToTargetUpdate adding {0} to move vector {1} for {2}",
// LocalVectorToTarget3D, agent_control_v3, Name);
agent_control_v3 += LocalVectorToTarget3D; agent_control_v3 += LocalVectorToTarget3D;
} }
catch (Exception e) catch (Exception e)
@ -1711,8 +1719,10 @@ namespace OpenSim.Region.Framework.Scenes
/// </summary> /// </summary>
public void ResetMoveToTarget() public void ResetMoveToTarget()
{ {
MoveToPositionTarget = Vector3.Zero; // m_log.DebugFormat("[SCENE PRESENCE]: Resetting move to target for {0}", Name);
m_moveToPositionInProgress = false; m_moveToPositionInProgress = false;
MoveToPositionTarget = Vector3.Zero;
} }
private void CheckAtSitTarget() private void CheckAtSitTarget()