diff options
author | Melanie | 2013-07-24 04:45:07 +0100 |
---|---|---|
committer | Melanie | 2013-07-24 04:45:07 +0100 |
commit | e82d4154a2e348e4a38f01cb1877878c94569bba (patch) | |
tree | 7b27e6d30d04f6089fd17d5779cfb0a81e50d508 /OpenSim/Region/Framework/Scenes/ScenePresence.cs | |
parent | Merge branch 'master' into careminster (diff) | |
parent | For unknown user issue, bump GUN7 to GUN8 and UMMAU3 to UMMAU4 to assess what... (diff) | |
download | opensim-SC-e82d4154a2e348e4a38f01cb1877878c94569bba.zip opensim-SC-e82d4154a2e348e4a38f01cb1877878c94569bba.tar.gz opensim-SC-e82d4154a2e348e4a38f01cb1877878c94569bba.tar.bz2 opensim-SC-e82d4154a2e348e4a38f01cb1877878c94569bba.tar.xz |
Merge branch 'master' into careminster
Conflicts:
OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs
OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
OpenSim/Region/Framework/Scenes/ScenePresence.cs
OpenSim/Region/Physics/Manager/PhysicsActor.cs
OpenSim/Region/Physics/Manager/PhysicsScene.cs
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/ScenePresence.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 120 |
1 files changed, 96 insertions, 24 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 6e4ac98..1225c2e 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -142,6 +142,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
142 | private Vector3 m_lastVelocity; | 142 | private Vector3 m_lastVelocity; |
143 | private Vector3 m_lastSize = new Vector3(0.45f,0.6f,1.9f); | 143 | private Vector3 m_lastSize = new Vector3(0.45f,0.6f,1.9f); |
144 | 144 | ||
145 | private bool m_followCamAuto = false; | ||
146 | |||
145 | 147 | ||
146 | private Vector3? m_forceToApply; | 148 | private Vector3? m_forceToApply; |
147 | private int m_userFlags; | 149 | private int m_userFlags; |
@@ -874,6 +876,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
874 | { | 876 | { |
875 | ControllingClient.OnCompleteMovementToRegion += CompleteMovement; | 877 | ControllingClient.OnCompleteMovementToRegion += CompleteMovement; |
876 | ControllingClient.OnAgentUpdate += HandleAgentUpdate; | 878 | ControllingClient.OnAgentUpdate += HandleAgentUpdate; |
879 | ControllingClient.OnAgentCameraUpdate += HandleAgentCamerasUpdate; | ||
877 | ControllingClient.OnAgentRequestSit += HandleAgentRequestSit; | 880 | ControllingClient.OnAgentRequestSit += HandleAgentRequestSit; |
878 | ControllingClient.OnAgentSit += HandleAgentSit; | 881 | ControllingClient.OnAgentSit += HandleAgentSit; |
879 | ControllingClient.OnSetAlwaysRun += HandleSetAlwaysRun; | 882 | ControllingClient.OnSetAlwaysRun += HandleSetAlwaysRun; |
@@ -1306,7 +1309,26 @@ namespace OpenSim.Region.Framework.Scenes | |||
1306 | 1309 | ||
1307 | public void StopFlying() | 1310 | public void StopFlying() |
1308 | { | 1311 | { |
1309 | ControllingClient.StopFlying(this); | 1312 | Vector3 pos = AbsolutePosition; |
1313 | if (Appearance.AvatarHeight != 127.0f) | ||
1314 | pos += new Vector3(0f, 0f, (Appearance.AvatarHeight / 6f)); | ||
1315 | else | ||
1316 | pos += new Vector3(0f, 0f, (1.56f / 6f)); | ||
1317 | |||
1318 | AbsolutePosition = pos; | ||
1319 | |||
1320 | // attach a suitable collision plane regardless of the actual situation to force the LLClient to land. | ||
1321 | // Collision plane below the avatar's position a 6th of the avatar's height is suitable. | ||
1322 | // Mind you, that this method doesn't get called if the avatar's velocity magnitude is greater then a | ||
1323 | // certain amount.. because the LLClient wouldn't land in that situation anyway. | ||
1324 | |||
1325 | // why are we still testing for this really old height value default??? | ||
1326 | if (Appearance.AvatarHeight != 127.0f) | ||
1327 | CollisionPlane = new Vector4(0, 0, 0, pos.Z - Appearance.AvatarHeight / 6f); | ||
1328 | else | ||
1329 | CollisionPlane = new Vector4(0, 0, 0, pos.Z - (1.56f / 6f)); | ||
1330 | |||
1331 | ControllingClient.SendAgentTerseUpdate(this); | ||
1310 | } | 1332 | } |
1311 | 1333 | ||
1312 | /// <summary> | 1334 | /// <summary> |
@@ -1662,9 +1684,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
1662 | /// </summary> | 1684 | /// </summary> |
1663 | public void HandleAgentUpdate(IClientAPI remoteClient, AgentUpdateArgs agentData) | 1685 | public void HandleAgentUpdate(IClientAPI remoteClient, AgentUpdateArgs agentData) |
1664 | { | 1686 | { |
1665 | // m_log.DebugFormat( | 1687 | //m_log.DebugFormat( |
1666 | // "[SCENE PRESENCE]: In {0} received agent update from {1}, flags {2}", | 1688 | // "[SCENE PRESENCE]: In {0} received agent update from {1}, flags {2}", |
1667 | // Scene.RegionInfo.RegionName, remoteClient.Name, (AgentManager.ControlFlags)agentData.ControlFlags); | 1689 | // Scene.RegionInfo.RegionName, remoteClient.Name, (AgentManager.ControlFlags)agentData.ControlFlags); |
1668 | 1690 | ||
1669 | if (IsChildAgent) | 1691 | if (IsChildAgent) |
1670 | { | 1692 | { |
@@ -1672,10 +1694,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1672 | return; | 1694 | return; |
1673 | } | 1695 | } |
1674 | 1696 | ||
1675 | ++m_movementUpdateCount; | ||
1676 | if (m_movementUpdateCount < 1) | ||
1677 | m_movementUpdateCount = 1; | ||
1678 | |||
1679 | #region Sanity Checking | 1697 | #region Sanity Checking |
1680 | 1698 | ||
1681 | // This is irritating. Really. | 1699 | // This is irritating. Really. |
@@ -1706,21 +1724,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1706 | 1724 | ||
1707 | AgentManager.ControlFlags flags = (AgentManager.ControlFlags)agentData.ControlFlags; | 1725 | AgentManager.ControlFlags flags = (AgentManager.ControlFlags)agentData.ControlFlags; |
1708 | 1726 | ||
1709 | // Camera location in world. We'll need to raytrace | ||
1710 | // from this location from time to time. | ||
1711 | CameraPosition = agentData.CameraCenter; | ||
1712 | if (Vector3.Distance(m_lastCameraPosition, CameraPosition) >= Scene.RootReprioritizationDistance) | ||
1713 | { | ||
1714 | ReprioritizeUpdates(); | ||
1715 | m_lastCameraPosition = CameraPosition; | ||
1716 | } | ||
1717 | |||
1718 | // Use these three vectors to figure out what the agent is looking at | ||
1719 | // Convert it to a Matrix and/or Quaternion | ||
1720 | CameraAtAxis = agentData.CameraAtAxis; | ||
1721 | CameraLeftAxis = agentData.CameraLeftAxis; | ||
1722 | CameraUpAxis = agentData.CameraUpAxis; | ||
1723 | |||
1724 | // The Agent's Draw distance setting | 1727 | // The Agent's Draw distance setting |
1725 | // When we get to the point of re-computing neighbors everytime this | 1728 | // When we get to the point of re-computing neighbors everytime this |
1726 | // changes, then start using the agent's drawdistance rather than the | 1729 | // changes, then start using the agent's drawdistance rather than the |
@@ -2005,10 +2008,79 @@ namespace OpenSim.Region.Framework.Scenes | |||
2005 | SendControlsToScripts(flagsForScripts); | 2008 | SendControlsToScripts(flagsForScripts); |
2006 | } | 2009 | } |
2007 | 2010 | ||
2011 | // We need to send this back to the client in order to see the edit beams | ||
2012 | if ((State & (uint)AgentState.Editing) != 0) | ||
2013 | ControllingClient.SendAgentTerseUpdate(this); | ||
2014 | |||
2008 | m_scene.EventManager.TriggerOnClientMovement(this); | 2015 | m_scene.EventManager.TriggerOnClientMovement(this); |
2009 | TriggerScenePresenceUpdated(); | ||
2010 | } | 2016 | } |
2011 | 2017 | ||
2018 | |||
2019 | /// <summary> | ||
2020 | /// This is the event handler for client cameras. If a client is moving, or moving the camera, this event is triggering. | ||
2021 | /// </summary> | ||
2022 | private void HandleAgentCamerasUpdate(IClientAPI remoteClient, AgentUpdateArgs agentData) | ||
2023 | { | ||
2024 | //m_log.DebugFormat( | ||
2025 | // "[SCENE PRESENCE]: In {0} received agent camera update from {1}, flags {2}", | ||
2026 | // Scene.RegionInfo.RegionName, remoteClient.Name, (AgentManager.ControlFlags)agentData.ControlFlags); | ||
2027 | |||
2028 | if (IsChildAgent) | ||
2029 | { | ||
2030 | // // m_log.Debug("DEBUG: HandleAgentUpdate: child agent"); | ||
2031 | return; | ||
2032 | } | ||
2033 | |||
2034 | ++m_movementUpdateCount; | ||
2035 | if (m_movementUpdateCount < 1) | ||
2036 | m_movementUpdateCount = 1; | ||
2037 | |||
2038 | |||
2039 | AgentManager.ControlFlags flags = (AgentManager.ControlFlags)agentData.ControlFlags; | ||
2040 | |||
2041 | // Camera location in world. We'll need to raytrace | ||
2042 | // from this location from time to time. | ||
2043 | CameraPosition = agentData.CameraCenter; | ||
2044 | if (Vector3.Distance(m_lastCameraPosition, CameraPosition) >= Scene.RootReprioritizationDistance) | ||
2045 | { | ||
2046 | ReprioritizeUpdates(); | ||
2047 | m_lastCameraPosition = CameraPosition; | ||
2048 | } | ||
2049 | |||
2050 | // Use these three vectors to figure out what the agent is looking at | ||
2051 | // Convert it to a Matrix and/or Quaternion | ||
2052 | CameraAtAxis = agentData.CameraAtAxis; | ||
2053 | CameraLeftAxis = agentData.CameraLeftAxis; | ||
2054 | CameraUpAxis = agentData.CameraUpAxis; | ||
2055 | |||
2056 | // The Agent's Draw distance setting | ||
2057 | // When we get to the point of re-computing neighbors everytime this | ||
2058 | // changes, then start using the agent's drawdistance rather than the | ||
2059 | // region's draw distance. | ||
2060 | // DrawDistance = agentData.Far; | ||
2061 | DrawDistance = Scene.DefaultDrawDistance; | ||
2062 | |||
2063 | // Check if Client has camera in 'follow cam' or 'build' mode. | ||
2064 | Vector3 camdif = (Vector3.One * Rotation - Vector3.One * CameraRotation); | ||
2065 | |||
2066 | m_followCamAuto = ((CameraUpAxis.Z > 0.959f && CameraUpAxis.Z < 0.98f) | ||
2067 | && (Math.Abs(camdif.X) < 0.4f && Math.Abs(camdif.Y) < 0.4f)) ? true : false; | ||
2068 | |||
2069 | |||
2070 | //m_log.DebugFormat("[FollowCam]: {0}", m_followCamAuto); | ||
2071 | // Raycast from the avatar's head to the camera to see if there's anything blocking the view | ||
2072 | if ((m_movementUpdateCount % NumMovementsBetweenRayCast) == 0 && m_scene.PhysicsScene.SupportsRayCast()) | ||
2073 | { | ||
2074 | if (m_followCamAuto) | ||
2075 | { | ||
2076 | Vector3 posAdjusted = m_pos + HEAD_ADJUSTMENT; | ||
2077 | m_scene.PhysicsScene.RaycastWorld(m_pos, Vector3.Normalize(CameraPosition - posAdjusted), Vector3.Distance(CameraPosition, posAdjusted) + 0.3f, RayCastCameraCallback); | ||
2078 | } | ||
2079 | } | ||
2080 | |||
2081 | TriggerScenePresenceUpdated(); | ||
2082 | } | ||
2083 | |||
2012 | /// <summary> | 2084 | /// <summary> |
2013 | /// Calculate an update to move the presence to the set target. | 2085 | /// Calculate an update to move the presence to the set target. |
2014 | /// </summary> | 2086 | /// </summary> |