aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2011-08-04 02:31:40 +0100
committerJustin Clark-Casey (justincc)2011-08-04 02:31:40 +0100
commit54ce0293423b4286fe62cbadc3b1441cae5f78eb (patch)
tree4987da36ba6a80778ded16c2c9f6a7c5dfd189eb /OpenSim/Region/Framework
parentminor: remove some mono compiler warnings (diff)
downloadopensim-SC_OLD-54ce0293423b4286fe62cbadc3b1441cae5f78eb.zip
opensim-SC_OLD-54ce0293423b4286fe62cbadc3b1441cae5f78eb.tar.gz
opensim-SC_OLD-54ce0293423b4286fe62cbadc3b1441cae5f78eb.tar.bz2
opensim-SC_OLD-54ce0293423b4286fe62cbadc3b1441cae5f78eb.tar.xz
if an NPC move to target is above the terrain then make it fly to destination
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs26
1 files changed, 19 insertions, 7 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