diff options
author | Justin Clark-Casey (justincc) | 2015-02-26 00:48:51 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2015-02-26 00:48:51 +0000 |
commit | 412dd7dfc56a10f590a42d0e6d014da9f4551bbf (patch) | |
tree | 5e57ea2c030b12916885d0b84da90b5440db37e8 /OpenSim/Region/Framework/Scenes/ScenePresence.cs | |
parent | minor: In HGAssetMapper, don't complain on seeing an XmlDeclaration as we kno... (diff) | |
download | opensim-SC_OLD-412dd7dfc56a10f590a42d0e6d014da9f4551bbf.zip opensim-SC_OLD-412dd7dfc56a10f590a42d0e6d014da9f4551bbf.tar.gz opensim-SC_OLD-412dd7dfc56a10f590a42d0e6d014da9f4551bbf.tar.bz2 opensim-SC_OLD-412dd7dfc56a10f590a42d0e6d014da9f4551bbf.tar.xz |
When an avatar is walking across a region border, force the first AgentUpdate received on the new root agent to update movement parameters.
This prevents the avatar from drifting in its last direction of travel if a movement key was released at certain moments in the cross.
Relates to http://opensimulator.org/mantis/view.php?id=7435
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 0414f89..973f2cf 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -379,6 +379,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
379 | public uint MovementFlag { get; private set; } | 379 | public uint MovementFlag { get; private set; } |
380 | 380 | ||
381 | /// <summary> | 381 | /// <summary> |
382 | /// Set this if we need to force a movement update on the next received AgentUpdate from the viewer. | ||
383 | /// </summary> | ||
384 | private const uint ForceUpdateMovementFlagValue = uint.MaxValue; | ||
385 | |||
386 | /// <summary> | ||
382 | /// Is the agent stop control flag currently active? | 387 | /// Is the agent stop control flag currently active? |
383 | /// </summary> | 388 | /// </summary> |
384 | public bool AgentControlStopActive { get; private set; } | 389 | public bool AgentControlStopActive { get; private set; } |
@@ -1267,7 +1272,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1267 | // If we don't reset the movement flag here, an avatar that crosses to a neighbouring sim and returns will | 1272 | // If we don't reset the movement flag here, an avatar that crosses to a neighbouring sim and returns will |
1268 | // stall on the border crossing since the existing child agent will still have the last movement | 1273 | // stall on the border crossing since the existing child agent will still have the last movement |
1269 | // recorded, which stops the input from being processed. | 1274 | // recorded, which stops the input from being processed. |
1270 | MovementFlag = 0; | 1275 | MovementFlag = ForceUpdateMovementFlagValue; |
1271 | 1276 | ||
1272 | m_scene.EventManager.TriggerOnMakeRootAgent(this); | 1277 | m_scene.EventManager.TriggerOnMakeRootAgent(this); |
1273 | 1278 | ||
@@ -1925,13 +1930,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
1925 | /// </summary> | 1930 | /// </summary> |
1926 | public void HandleAgentUpdate(IClientAPI remoteClient, AgentUpdateArgs agentData) | 1931 | public void HandleAgentUpdate(IClientAPI remoteClient, AgentUpdateArgs agentData) |
1927 | { | 1932 | { |
1928 | //m_log.DebugFormat( | 1933 | // m_log.DebugFormat( |
1929 | // "[SCENE PRESENCE]: In {0} received agent update from {1}, flags {2}", | 1934 | // "[SCENE PRESENCE]: In {0} received agent update from {1}, flags {2}", |
1930 | // Scene.RegionInfo.RegionName, remoteClient.Name, (AgentManager.ControlFlags)agentData.ControlFlags); | 1935 | // Scene.Name, remoteClient.Name, (AgentManager.ControlFlags)agentData.ControlFlags); |
1931 | 1936 | ||
1932 | if (IsChildAgent) | 1937 | if (IsChildAgent) |
1933 | { | 1938 | { |
1934 | // // m_log.Debug("DEBUG: HandleAgentUpdate: child agent"); | 1939 | // m_log.DebugFormat("DEBUG: HandleAgentUpdate: child agent in {0}", Scene.Name); |
1935 | return; | 1940 | return; |
1936 | } | 1941 | } |
1937 | 1942 | ||
@@ -2066,6 +2071,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
2066 | 2071 | ||
2067 | bool update_movementflag = false; | 2072 | bool update_movementflag = false; |
2068 | 2073 | ||
2074 | // If we were just made root agent then we must perform movement updates for the first AgentUpdate that | ||
2075 | // we get | ||
2076 | if (MovementFlag == ForceUpdateMovementFlagValue) | ||
2077 | { | ||
2078 | MovementFlag = 0; | ||
2079 | update_movementflag = true; | ||
2080 | } | ||
2081 | |||
2069 | if (agentData.UseClientAgentPosition) | 2082 | if (agentData.UseClientAgentPosition) |
2070 | { | 2083 | { |
2071 | MovingToTarget = (agentData.ClientAgentPosition - AbsolutePosition).Length() > 0.2f; | 2084 | MovingToTarget = (agentData.ClientAgentPosition - AbsolutePosition).Length() > 0.2f; |