Stop avatars returning from neighbouring regions from stalling on the border crossing.

On making a root agent, we need to reset the ScenePresence.m_movement_flag so that it doesn't remember the
movement registered to the client when it exited the initial region.
If this is remember, then the client avatar movement isn't updated and it appears to stall in mid-air, though this is resolved with a prod/release of any other direction key.
This bug was probably introduced a few weeks ago.  Surprised that nobody brought it up.
bulletsim
Justin Clark-Casey (justincc) 2011-08-27 01:28:33 +01:00
parent 1615e7d29f
commit d4d894c20f
1 changed files with 22 additions and 3 deletions

View File

@ -965,6 +965,11 @@ namespace OpenSim.Region.Framework.Scenes
presence.Animator.SendAnimPackToClient(ControllingClient); presence.Animator.SendAnimPackToClient(ControllingClient);
}); });
// If we don't reset the movement flag here, an avatar that crosses to a neighbouring sim and returns will
// stall on the border crossing since the existing child agent will still have the last movement
// recorded, which stops the input from being processed.
m_movementflag = 0;
m_scene.EventManager.TriggerOnMakeRootAgent(this); m_scene.EventManager.TriggerOnMakeRootAgent(this);
} }
@ -1247,6 +1252,8 @@ namespace OpenSim.Region.Framework.Scenes
/// </summary> /// </summary>
public void HandleAgentUpdate(IClientAPI remoteClient, AgentUpdateArgs agentData) public void HandleAgentUpdate(IClientAPI remoteClient, AgentUpdateArgs agentData)
{ {
// m_log.DebugFormat("[SCENE PRESENCE]: Received agent update from {0}", remoteClient.Name);
//if (m_isChildAgent) //if (m_isChildAgent)
//{ //{
// // m_log.Debug("DEBUG: HandleAgentUpdate: child agent"); // // m_log.Debug("DEBUG: HandleAgentUpdate: child agent");
@ -1445,6 +1452,8 @@ namespace OpenSim.Region.Framework.Scenes
{ {
m_movementflag |= (byte)nudgehack; m_movementflag |= (byte)nudgehack;
} }
// m_log.DebugFormat("[SCENE PRESENCE]: Updating m_movementflag for {0} with {1}", Name, DCF);
m_movementflag += (byte)(uint)DCF; m_movementflag += (byte)(uint)DCF;
update_movementflag = true; update_movementflag = true;
} }
@ -1456,6 +1465,7 @@ namespace OpenSim.Region.Framework.Scenes
&& ((m_movementflag & (byte)nudgehack) == nudgehack)) && ((m_movementflag & (byte)nudgehack) == nudgehack))
) // This or is for Nudge forward ) // This or is for Nudge forward
{ {
// m_log.DebugFormat("[SCENE PRESENCE]: Updating m_movementflag for {0} with lack of {1}", Name, DCF);
m_movementflag -= ((byte)(uint)DCF); m_movementflag -= ((byte)(uint)DCF);
update_movementflag = true; update_movementflag = true;
@ -1520,12 +1530,21 @@ namespace OpenSim.Region.Framework.Scenes
// which occurs later in the main scene loop // which occurs later in the main scene loop
if (update_movementflag || (update_rotation && DCFlagKeyPressed)) if (update_movementflag || (update_rotation && DCFlagKeyPressed))
{ {
// m_log.DebugFormat("{0} {1}", update_movementflag, (update_rotation && DCFlagKeyPressed)); // m_log.DebugFormat(
// m_log.DebugFormat( // "[SCENE PRESENCE]: In {0} adding velocity of {1} to {2}, umf = {3}, ur = {4}",
// "In {0} adding velocity to {1} of {2}", m_scene.RegionInfo.RegionName, Name, agent_control_v3); // m_scene.RegionInfo.RegionName, agent_control_v3, Name, update_movementflag, update_rotation);
AddNewMovement(agent_control_v3); AddNewMovement(agent_control_v3);
} }
// else
// {
// if (!update_movementflag)
// {
// m_log.DebugFormat(
// "[SCENE PRESENCE]: In {0} ignoring requested update of {1} for {2} as update_movementflag = false",
// m_scene.RegionInfo.RegionName, agent_control_v3, Name);
// }
// }
if (update_movementflag && m_parentID == 0) if (update_movementflag && m_parentID == 0)
Animator.UpdateMovementAnimations(); Animator.UpdateMovementAnimations();