aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs26
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs10
2 files changed, 26 insertions, 10 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 98e90b9..17b55bf 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -217,8 +217,7 @@ namespace OpenSim.Region.Framework.Scenes
217 private string m_nextSitAnimation = String.Empty; 217 private string m_nextSitAnimation = String.Empty;
218 218
219 //PauPaw:Proper PID Controler for autopilot************ 219 //PauPaw:Proper PID Controler for autopilot************
220 private bool m_moveToPositionInProgress; 220 public bool MovingToTarget { get; private set; }
221
222 public Vector3 MoveToPositionTarget { get; private set; } 221 public Vector3 MoveToPositionTarget { get; private set; }
223 222
224 private bool m_followCamAuto; 223 private bool m_followCamAuto;
@@ -1385,7 +1384,7 @@ namespace OpenSim.Region.Framework.Scenes
1385 1384
1386 if (agentData.UseClientAgentPosition) 1385 if (agentData.UseClientAgentPosition)
1387 { 1386 {
1388 m_moveToPositionInProgress = (agentData.ClientAgentPosition - AbsolutePosition).Length() > 0.2f; 1387 MovingToTarget = (agentData.ClientAgentPosition - AbsolutePosition).Length() > 0.2f;
1389 MoveToPositionTarget = agentData.ClientAgentPosition; 1388 MoveToPositionTarget = agentData.ClientAgentPosition;
1390 } 1389 }
1391 1390
@@ -1484,7 +1483,7 @@ namespace OpenSim.Region.Framework.Scenes
1484 i++; 1483 i++;
1485 } 1484 }
1486 1485
1487 if (m_moveToPositionInProgress) 1486 if (MovingToTarget)
1488 { 1487 {
1489 // If the user has pressed a key then we want to cancel any move to target. 1488 // If the user has pressed a key then we want to cancel any move to target.
1490 if (DCFlagKeyPressed) 1489 if (DCFlagKeyPressed)
@@ -1539,7 +1538,7 @@ namespace OpenSim.Region.Framework.Scenes
1539 && ((flags & AgentManager.ControlFlags.AGENT_CONTROL_SIT_ON_GROUND) == 0) 1538 && ((flags & AgentManager.ControlFlags.AGENT_CONTROL_SIT_ON_GROUND) == 0)
1540 && (m_parentID == 0) 1539 && (m_parentID == 0)
1541 && !SitGround 1540 && !SitGround
1542 && !m_moveToPositionInProgress) 1541 && !MovingToTarget)
1543 Animator.UpdateMovementAnimations(); 1542 Animator.UpdateMovementAnimations();
1544 } 1543 }
1545 1544
@@ -1706,7 +1705,20 @@ namespace OpenSim.Region.Framework.Scenes
1706 float terrainHeight = (float)m_scene.Heightmap[(int)pos.X, (int)pos.Y]; 1705 float terrainHeight = (float)m_scene.Heightmap[(int)pos.X, (int)pos.Y];
1707 pos.Z = Math.Max(terrainHeight, pos.Z); 1706 pos.Z = Math.Max(terrainHeight, pos.Z);
1708 1707
1709 m_moveToPositionInProgress = true; 1708 // Fudge factor. It appears that if one clicks "go here" on a piece of ground, the go here request is
1709 // always slightly higher than the actual terrain height.
1710 // FIXME: This constrains NOC movements as well, so should be somewhere else.
1711 if (pos.Z - terrainHeight < 0.2)
1712 pos.Z = terrainHeight;
1713
1714// m_log.DebugFormat(
1715// "[SCENE PRESENCE]: Avatar {0} set move to target {1} (terrain height {2}) in {3}",
1716// Name, pos, terrainHeight, m_scene.RegionInfo.RegionName);
1717
1718 if (pos.Z > terrainHeight)
1719 PhysicsActor.Flying = true;
1720
1721 MovingToTarget = true;
1710 MoveToPositionTarget = pos; 1722 MoveToPositionTarget = pos;
1711 1723
1712 Vector3 agent_control_v3 = new Vector3(); 1724 Vector3 agent_control_v3 = new Vector3();
@@ -1721,7 +1733,7 @@ namespace OpenSim.Region.Framework.Scenes
1721 { 1733 {
1722 m_log.DebugFormat("[SCENE PRESENCE]: Resetting move to target for {0}", Name); 1734 m_log.DebugFormat("[SCENE PRESENCE]: Resetting move to target for {0}", Name);
1723 1735
1724 m_moveToPositionInProgress = false; 1736 MovingToTarget = false;
1725 MoveToPositionTarget = Vector3.Zero; 1737 MoveToPositionTarget = Vector3.Zero;
1726 } 1738 }
1727 1739
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
index 2215495..30e81fc 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
@@ -62,7 +62,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
62 { 62 {
63 lock (m_avatars) 63 lock (m_avatars)
64 { 64 {
65 if (m_avatars.ContainsKey(presence.UUID)) 65 if (m_avatars.ContainsKey(presence.UUID) && presence.MovingToTarget)
66 { 66 {
67 double distanceToTarget = Util.GetDistanceTo(presence.AbsolutePosition, presence.MoveToPositionTarget); 67 double distanceToTarget = Util.GetDistanceTo(presence.AbsolutePosition, presence.MoveToPositionTarget);
68// m_log.DebugFormat( 68// m_log.DebugFormat(
@@ -72,8 +72,8 @@ namespace OpenSim.Region.OptionalModules.World.NPC
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 <= ScenePresence.SIGNIFICANT_MOVEMENT) 73 if (distanceToTarget <= ScenePresence.SIGNIFICANT_MOVEMENT)
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}", presence.Name);
76 // We are close enough to the target for now 76 // We are close enough to the target
77 presence.Velocity = Vector3.Zero; 77 presence.Velocity = Vector3.Zero;
78 presence.AbsolutePosition = presence.MoveToPositionTarget; 78 presence.AbsolutePosition = presence.MoveToPositionTarget;
79 presence.ResetMoveToTarget(); 79 presence.ResetMoveToTarget();
@@ -86,6 +86,10 @@ namespace OpenSim.Region.OptionalModules.World.NPC
86 } 86 }
87 else 87 else
88 { 88 {
89 m_log.DebugFormat(
90 "[NPC MODULE]: Updating npc {0} at {1} for next movement to {2}",
91 presence.Name, presence.AbsolutePosition, presence.MoveToPositionTarget);
92
89 Vector3 agent_control_v3 = new Vector3(); 93 Vector3 agent_control_v3 = new Vector3();
90 presence.HandleMoveToTargetUpdate(ref agent_control_v3, presence.Rotation); 94 presence.HandleMoveToTargetUpdate(ref agent_control_v3, presence.Rotation);
91 presence.AddNewMovement(agent_control_v3, presence.Rotation); 95 presence.AddNewMovement(agent_control_v3, presence.Rotation);