diff options
author | Justin Clark-Casey (justincc) | 2011-08-04 01:00:33 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2011-08-04 01:00:33 +0100 |
commit | 7f6f100c5a93791e8af29bafcfb93cfd289d5e8b (patch) | |
tree | f36b5dfbc1414fa2564429dd3f4eec6dc1479201 /OpenSim/Region/OptionalModules/World | |
parent | extend npc move test to check a second movement (diff) | |
download | opensim-SC_OLD-7f6f100c5a93791e8af29bafcfb93cfd289d5e8b.zip opensim-SC_OLD-7f6f100c5a93791e8af29bafcfb93cfd289d5e8b.tar.gz opensim-SC_OLD-7f6f100c5a93791e8af29bafcfb93cfd289d5e8b.tar.bz2 opensim-SC_OLD-7f6f100c5a93791e8af29bafcfb93cfd289d5e8b.tar.xz |
When the NPC reaches within the SIGNIFICANT_CLIENT_MOVEMENT distance of the target, move it directly to the target.
This makes the movement exact. Regression test changed to check avatar reaches exact target.
Also has the nice side effect of making NPC animations continue to work after the first movement (which wasn't working). However, avatar still pauses in mid-stride
Diffstat (limited to 'OpenSim/Region/OptionalModules/World')
-rw-r--r-- | OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs | 5 | ||||
-rw-r--r-- | OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs | 2 |
2 files changed, 5 insertions, 2 deletions
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs index dd94240..fdc3485 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 | |||
70 | // presence.Name, presence.AbsolutePosition, presence.MoveToPositionTarget, distanceToTarget); | 70 | // presence.Name, presence.AbsolutePosition, presence.MoveToPositionTarget, distanceToTarget); |
71 | 71 | ||
72 | // Check the error term of the current position in relation to the target position | 72 | // Check the error term of the current position in relation to the target position |
73 | if (distanceToTarget <= 1) | 73 | if (distanceToTarget <= 2) |
74 | { | 74 | { |
75 | // m_log.DebugFormat("[NPC MODULE]: Stopping movement of npc {0} {1}", presence.Name, presence.UUID); | 75 | // m_log.DebugFormat("[NPC MODULE]: Stopping movement of npc {0} {1}", presence.Name, presence.UUID); |
76 | // We are close enough to the target for now | 76 | // We are close enough to the target for now |
77 | presence.ResetMoveToTarget(); | ||
78 | presence.Velocity = Vector3.Zero; | 77 | presence.Velocity = Vector3.Zero; |
78 | presence.AbsolutePosition = presence.MoveToPositionTarget; | ||
79 | presence.ResetMoveToTarget(); | ||
79 | 80 | ||
80 | // FIXME: This doesn't work | 81 | // FIXME: This doesn't work |
81 | if (presence.PhysicsActor.Flying) | 82 | 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 545819f..c9dddba 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 | |||
130 | 130 | ||
131 | double distanceToTarget = Util.GetDistanceTo(npc.AbsolutePosition, targetPos); | 131 | double distanceToTarget = Util.GetDistanceTo(npc.AbsolutePosition, targetPos); |
132 | Assert.That(distanceToTarget, Is.LessThan(1), "NPC not within 1 unit of target position on first move"); | 132 | Assert.That(distanceToTarget, Is.LessThan(1), "NPC not within 1 unit of target position on first move"); |
133 | Assert.That(npc.AbsolutePosition, Is.EqualTo(targetPos)); | ||
133 | 134 | ||
134 | // Try a second movement | 135 | // Try a second movement |
135 | startPos = npc.AbsolutePosition; | 136 | startPos = npc.AbsolutePosition; |
@@ -149,6 +150,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests | |||
149 | 150 | ||
150 | distanceToTarget = Util.GetDistanceTo(npc.AbsolutePosition, targetPos); | 151 | distanceToTarget = Util.GetDistanceTo(npc.AbsolutePosition, targetPos); |
151 | Assert.That(distanceToTarget, Is.LessThan(1), "NPC not within 1 unit of target position on second move"); | 152 | Assert.That(distanceToTarget, Is.LessThan(1), "NPC not within 1 unit of target position on second move"); |
153 | Assert.That(npc.AbsolutePosition, Is.EqualTo(targetPos)); | ||
152 | } | 154 | } |
153 | } | 155 | } |
154 | } \ No newline at end of file | 156 | } \ No newline at end of file |