diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 54ef0394ff..ba10423615 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1575,6 +1575,7 @@ namespace OpenSim.Region.Framework.Scenes if (distanceToTarget <= 1) { // We are close enough to the target + AbsolutePosition = MoveToPositionTarget; ResetMoveToTarget(); updated = true; } @@ -1713,7 +1714,7 @@ namespace OpenSim.Region.Framework.Scenes /// public void ResetMoveToTarget() { -// m_log.DebugFormat("[SCENE PRESENCE]: Resetting move to target for {0}", Name); + m_log.DebugFormat("[SCENE PRESENCE]: Resetting move to target for {0}", Name); m_moveToPositionInProgress = false; MoveToPositionTarget = Vector3.Zero; diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs index dd94240ce4..fdc3485246 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs @@ -70,12 +70,13 @@ namespace OpenSim.Region.OptionalModules.World.NPC // presence.Name, presence.AbsolutePosition, presence.MoveToPositionTarget, distanceToTarget); // Check the error term of the current position in relation to the target position - if (distanceToTarget <= 1) + if (distanceToTarget <= 2) { // m_log.DebugFormat("[NPC MODULE]: Stopping movement of npc {0} {1}", presence.Name, presence.UUID); // We are close enough to the target for now - presence.ResetMoveToTarget(); presence.Velocity = Vector3.Zero; + presence.AbsolutePosition = presence.MoveToPositionTarget; + presence.ResetMoveToTarget(); // FIXME: This doesn't work if (presence.PhysicsActor.Flying) diff --git a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs index 545819ff53..c9dddbace8 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs @@ -130,6 +130,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests double distanceToTarget = Util.GetDistanceTo(npc.AbsolutePosition, targetPos); Assert.That(distanceToTarget, Is.LessThan(1), "NPC not within 1 unit of target position on first move"); + Assert.That(npc.AbsolutePosition, Is.EqualTo(targetPos)); // Try a second movement startPos = npc.AbsolutePosition; @@ -149,6 +150,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests distanceToTarget = Util.GetDistanceTo(npc.AbsolutePosition, targetPos); Assert.That(distanceToTarget, Is.LessThan(1), "NPC not within 1 unit of target position on second move"); + Assert.That(npc.AbsolutePosition, Is.EqualTo(targetPos)); } } } \ No newline at end of file