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=7435inv-download
parent
5fa651c529
commit
412dd7dfc5
|
@ -378,6 +378,11 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public uint MovementFlag { get; private set; }
|
public uint MovementFlag { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Set this if we need to force a movement update on the next received AgentUpdate from the viewer.
|
||||||
|
/// </summary>
|
||||||
|
private const uint ForceUpdateMovementFlagValue = uint.MaxValue;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Is the agent stop control flag currently active?
|
/// Is the agent stop control flag currently active?
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -1267,7 +1272,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// If we don't reset the movement flag here, an avatar that crosses to a neighbouring sim and returns will
|
// 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
|
// stall on the border crossing since the existing child agent will still have the last movement
|
||||||
// recorded, which stops the input from being processed.
|
// recorded, which stops the input from being processed.
|
||||||
MovementFlag = 0;
|
MovementFlag = ForceUpdateMovementFlagValue;
|
||||||
|
|
||||||
m_scene.EventManager.TriggerOnMakeRootAgent(this);
|
m_scene.EventManager.TriggerOnMakeRootAgent(this);
|
||||||
|
|
||||||
|
@ -1925,13 +1930,13 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void HandleAgentUpdate(IClientAPI remoteClient, AgentUpdateArgs agentData)
|
public void HandleAgentUpdate(IClientAPI remoteClient, AgentUpdateArgs agentData)
|
||||||
{
|
{
|
||||||
//m_log.DebugFormat(
|
// m_log.DebugFormat(
|
||||||
// "[SCENE PRESENCE]: In {0} received agent update from {1}, flags {2}",
|
// "[SCENE PRESENCE]: In {0} received agent update from {1}, flags {2}",
|
||||||
// Scene.RegionInfo.RegionName, remoteClient.Name, (AgentManager.ControlFlags)agentData.ControlFlags);
|
// Scene.Name, remoteClient.Name, (AgentManager.ControlFlags)agentData.ControlFlags);
|
||||||
|
|
||||||
if (IsChildAgent)
|
if (IsChildAgent)
|
||||||
{
|
{
|
||||||
// // m_log.Debug("DEBUG: HandleAgentUpdate: child agent");
|
// m_log.DebugFormat("DEBUG: HandleAgentUpdate: child agent in {0}", Scene.Name);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2066,6 +2071,14 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
bool update_movementflag = false;
|
bool update_movementflag = false;
|
||||||
|
|
||||||
|
// If we were just made root agent then we must perform movement updates for the first AgentUpdate that
|
||||||
|
// we get
|
||||||
|
if (MovementFlag == ForceUpdateMovementFlagValue)
|
||||||
|
{
|
||||||
|
MovementFlag = 0;
|
||||||
|
update_movementflag = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (agentData.UseClientAgentPosition)
|
if (agentData.UseClientAgentPosition)
|
||||||
{
|
{
|
||||||
MovingToTarget = (agentData.ClientAgentPosition - AbsolutePosition).Length() > 0.2f;
|
MovingToTarget = (agentData.ClientAgentPosition - AbsolutePosition).Length() > 0.2f;
|
||||||
|
|
Loading…
Reference in New Issue