From dc835717d66678eddfd802717a068c6131e460fc Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 23 Feb 2012 14:08:35 +0100 Subject: [PATCH 1/6] Properly sequence updates of avatars and attachments so that we don't update attachments on child avatars or intermingle agent and attachment updates, which would render the root prim of huds invisible --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 8 ++++++++ OpenSim/Region/Framework/Scenes/ScenePresence.cs | 3 +++ 2 files changed, 11 insertions(+) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 1ac3b76350..2e86315aaa 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -3774,6 +3774,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP // doesn't seem to be attached, skip if (!found) continue; + + // On vehicle crossing, the attachments are received + // while the avatar is still a child. Don't send + // updates here because the LocalId has not yet + // been updated and the viewer will derender the + // attachments until the avatar becomes root. + if (sp.IsChildAgent) + continue; } if (part.ParentGroup.IsAttachment && m_disableFacelights) { diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index a3839c2501..2c118d6eef 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -984,6 +984,7 @@ namespace OpenSim.Region.Framework.Scenes Util.FireAndForget(delegate(object x) { foreach (SceneObjectGroup sog in m_attachments) { + sog.ScheduleGroupForFullUpdate(); sog.RootPart.ParentGroup.CreateScriptInstances(0, false, m_scene.DefaultScriptEngine, GetStateSource()); sog.ResumeScripts(); } @@ -991,6 +992,8 @@ namespace OpenSim.Region.Framework.Scenes } } + SendAvatarDataToAllAgents(); + // send the animations of the other presences to me m_scene.ForEachRootScenePresence(delegate(ScenePresence presence) { From f3ea2bde617fa6c55b89973cdea2fb8e217d83bd Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 23 Feb 2012 20:32:35 +0100 Subject: [PATCH 2/6] Fix preserving the animation state of a crossing seated avatar --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 2c118d6eef..06da741a04 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -874,6 +874,8 @@ namespace OpenSim.Region.Framework.Scenes "[SCENE]: Upgrading child to root agent for {0} in {1}", Name, m_scene.RegionInfo.RegionName); + bool wasChild = IsChildAgent; + if (ParentUUID != UUID.Zero) { m_log.DebugFormat("[SCENE PRESENCE]: Sitting avatar back on prim {0}", ParentUUID); @@ -893,10 +895,16 @@ namespace OpenSim.Region.Framework.Scenes pos = ParentPosition; } ParentUUID = UUID.Zero; + + IsChildAgent = false; + + Animator.TrySetMovementAnimation("SIT"); + } + else + { + IsChildAgent = false; } - bool wasChild = IsChildAgent; - IsChildAgent = false; IGroupsModule gm = m_scene.RequestModuleInterface(); if (gm != null) From 1c0adfa6e025045b6c309943f886f641a4df8e38 Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 23 Feb 2012 22:26:17 +0100 Subject: [PATCH 3/6] Correct sit position calculations --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 2e86315aaa..f835e56f3d 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -4845,7 +4845,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (part != null && part != part.ParentGroup.RootPart) { position = part.OffsetPosition + presence.OffsetPosition * part.RotationOffset; - rotation = presence.Rotation * part.RotationOffset; + rotation = part.RotationOffset * presence.Rotation; } } @@ -4974,7 +4974,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (part != null && part != part.ParentGroup.RootPart) { offsetPosition = part.OffsetPosition + data.OffsetPosition * part.RotationOffset; - rotation = data.Rotation * part.RotationOffset; + rotation = part.RotationOffset * data.Rotation; parentID = part.ParentGroup.RootPart.LocalId; } } From 90ea00a1098c918d5eb5a2be2793b109c6622a35 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Thu, 23 Feb 2012 22:56:42 +0000 Subject: [PATCH 4/6] Try to resolve some problems with viewers crashing after hitting parcel banlines or freezing on the banline. This involves 1) On forcible teleport, call m_scene.RequestTeleportLocation() rather than ScenePresence.Teleport() - only EntityTransferModule now should call SP.Teleport() 2) When avatar is being forcibly moved due to banlines, use a 'stop movement' tolerance of 0.2 to requested position rather than 1 This prevents the avatar sometimes being stuck to banlines until they teleport somewhere else. This aims to fix some problems in http://opensimulator.org/mantis/view.php?id=5822 --- .../World/Land/LandManagementModule.cs | 27 ++++++++++++++----- OpenSim/Region/Framework/Scenes/Scene.cs | 17 ++++++++---- .../Region/Framework/Scenes/ScenePresence.cs | 13 +++++---- 3 files changed, 41 insertions(+), 16 deletions(-) diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index 1c503aa8c3..f6d4b401c1 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs @@ -94,8 +94,11 @@ namespace OpenSim.Region.CoreModules.World.Land // caches ExtendedLandData private Cache parcelInfoCache; - private Dictionary forcedPosition = - new Dictionary(); + + /// + /// Record positions that avatar's are currently being forced to move to due to parcel entry restrictions. + /// + private Dictionary forcedPosition = new Dictionary(); #region INonSharedRegionModule Members @@ -224,22 +227,34 @@ namespace OpenSim.Region.CoreModules.World.Land //When the avatar walks into a ban line on the ground, it prevents getting stuck agentData.ControlFlags = (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY; - //Make sure we stop if they get about to the right place to prevent yoyo and prevents getting stuck on banlines if (Vector3.Distance(clientAvatar.AbsolutePosition, forcedPosition[remoteClient.AgentId]) < .2) { - Debug.WriteLine(string.Format("Stopping force position because {0} is close enough to position {1}", forcedPosition[remoteClient.AgentId], clientAvatar.AbsolutePosition)); +// m_log.DebugFormat( +// "[LAND MANAGEMENT MODULE]: Stopping force position of {0} because {1} is close enough to {2}", +// clientAvatar.Name, clientAvatar.AbsolutePosition, forcedPosition[remoteClient.AgentId]); + forcedPosition.Remove(remoteClient.AgentId); } //if we are far away, teleport else if (Vector3.Distance(clientAvatar.AbsolutePosition, forcedPosition[remoteClient.AgentId]) > 3) { - Debug.WriteLine(string.Format("Teleporting out because {0} is too far from avatar position {1}", forcedPosition[remoteClient.AgentId], clientAvatar.AbsolutePosition)); - clientAvatar.Teleport(forcedPosition[remoteClient.AgentId]); + Vector3 forcePosition = forcedPosition[remoteClient.AgentId]; +// m_log.DebugFormat( +// "[LAND MANAGEMENT MODULE]: Teleporting out {0} because {1} is too far from avatar position {2}", +// clientAvatar.Name, clientAvatar.AbsolutePosition, forcePosition); + + m_scene.RequestTeleportLocation(remoteClient, m_scene.RegionInfo.RegionHandle, + forcePosition, clientAvatar.Lookat, (uint)Constants.TeleportFlags.ForceRedirect); + forcedPosition.Remove(remoteClient.AgentId); } else { +// m_log.DebugFormat( +// "[LAND MANAGEMENT MODULE]: Forcing {0} from {1} to {2}", +// clientAvatar.Name, clientAvatar.AbsolutePosition, forcedPosition[remoteClient.AgentId]); + //Forces them toward the forced position we want if they aren't there yet agentData.UseClientAgentPosition = true; agentData.ClientAgentPosition = forcedPosition[remoteClient.AgentId]; diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 61878031d5..cf6e6af727 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -4699,7 +4699,10 @@ namespace OpenSim.Region.Framework.Scenes Vector3? nearestPoint = GetNearestPointInParcelAlongDirectionFromPoint(avatar.AbsolutePosition, dir, nearestParcel); if (nearestPoint != null) { - Debug.WriteLine("Found a sane previous position based on velocity, sending them to: " + nearestPoint.ToString()); +// m_log.DebugFormat( +// "[SCENE]: Found a sane previous position based on velocity for {0}, sending them to {1} in {2}", +// avatar.Name, nearestPoint, nearestParcel.LandData.Name); + return nearestPoint.Value; } @@ -4709,12 +4712,16 @@ namespace OpenSim.Region.Framework.Scenes nearestPoint = GetNearestPointInParcelAlongDirectionFromPoint(avatar.AbsolutePosition, dir, nearestParcel); if (nearestPoint != null) { - Debug.WriteLine("They had a zero velocity, sending them to: " + nearestPoint.ToString()); +// m_log.DebugFormat( +// "[SCENE]: {0} had a zero velocity, sending them to {1}", avatar.Name, nearestPoint); + return nearestPoint.Value; } - //Ultimate backup if we have no idea where they are - Debug.WriteLine("Have no idea where they are, sending them to: " + avatar.lastKnownAllowedPosition.ToString()); + //Ultimate backup if we have no idea where they are +// m_log.DebugFormat( +// "[SCENE]: No idea where {0} is, sending them to {1}", avatar.Name, avatar.lastKnownAllowedPosition); + return avatar.lastKnownAllowedPosition; } @@ -5120,7 +5127,7 @@ namespace OpenSim.Region.Framework.Scenes // presence.Name, presence.AbsolutePosition, presence.MoveToPositionTarget); Vector3 agent_control_v3 = new Vector3(); - presence.HandleMoveToTargetUpdate(ref agent_control_v3); + presence.HandleMoveToTargetUpdate(1, ref agent_control_v3); presence.AddNewMovement(agent_control_v3); } } diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 9cfdf9fe9f..40c8d0600a 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1048,7 +1048,7 @@ namespace OpenSim.Region.Framework.Scenes } /// - /// + /// Do not call this directly. Call Scene.RequestTeleportLocation() instead. /// /// public void Teleport(Vector3 pos) @@ -1522,7 +1522,10 @@ namespace OpenSim.Region.Framework.Scenes } else if (bAllowUpdateMoveToPosition) { - if (HandleMoveToTargetUpdate(ref agent_control_v3)) + // The UseClientAgentPosition is set if parcel ban is forcing the avatar to move to a + // certain position. It's only check for tolerance on returning to that position is 0.2 + // rather than 1, at which point it removes its force target. + if (HandleMoveToTargetUpdate(agentData.UseClientAgentPosition ? 0.2 : 1, ref agent_control_v3)) update_movementflag = true; } } @@ -1584,7 +1587,7 @@ namespace OpenSim.Region.Framework.Scenes /// /// Cumulative agent movement that this method will update. /// True if movement has been updated in some way. False otherwise. - public bool HandleMoveToTargetUpdate(ref Vector3 agent_control_v3) + public bool HandleMoveToTargetUpdate(double tolerance, ref Vector3 agent_control_v3) { // m_log.DebugFormat("[SCENE PRESENCE]: Called HandleMoveToTargetUpdate() for {0}", Name); @@ -1601,7 +1604,7 @@ namespace OpenSim.Region.Framework.Scenes // Name, AbsolutePosition, MoveToPositionTarget, distanceToTarget); // Check the error term of the current position in relation to the target position - if (distanceToTarget <= 1) + if (distanceToTarget <= tolerance) { // We are close enough to the target AbsolutePosition = MoveToPositionTarget; @@ -1777,7 +1780,7 @@ namespace OpenSim.Region.Framework.Scenes // m_log.DebugFormat("[SCENE PRESENCE]: Body rot for {0} set to {1}", Name, Rotation); Vector3 agent_control_v3 = new Vector3(); - HandleMoveToTargetUpdate(ref agent_control_v3); + HandleMoveToTargetUpdate(1, ref agent_control_v3); AddNewMovement(agent_control_v3); } From daf58575f8a8a4610dab833d00b94811732c33cc Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 23 Feb 2012 23:05:04 +0000 Subject: [PATCH 5/6] Partially apply the core banlines fix --- OpenSim/Region/Framework/Scenes/Scene.cs | 2 +- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index b7162da5b1..fcbed9f963 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -5472,7 +5472,7 @@ Environment.Exit(1); // presence.Name, presence.AbsolutePosition, presence.MoveToPositionTarget); Vector3 agent_control_v3 = new Vector3(); - presence.HandleMoveToTargetUpdate(ref agent_control_v3); + presence.HandleMoveToTargetUpdate(1, ref agent_control_v3); presence.AddNewMovement(agent_control_v3); } } diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 06da741a04..26fa6c0bfa 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1095,7 +1095,7 @@ namespace OpenSim.Region.Framework.Scenes } /// - /// + /// Do not call this directly. Call Scene.RequestTeleportLocation() instead. /// /// public void Teleport(Vector3 pos) @@ -1569,7 +1569,10 @@ namespace OpenSim.Region.Framework.Scenes } else if (bAllowUpdateMoveToPosition) { - if (HandleMoveToTargetUpdate(ref agent_control_v3)) + // The UseClientAgentPosition is set if parcel ban is forcing the avatar to move to a + // certain position. It's only check for tolerance on returning to that position is 0.2 + // rather than 1, at which point it removes its force target. + if (HandleMoveToTargetUpdate(agentData.UseClientAgentPosition ? 0.2 : 1, ref agent_control_v3)) update_movementflag = true; } } @@ -1631,7 +1634,7 @@ namespace OpenSim.Region.Framework.Scenes /// /// Cumulative agent movement that this method will update. /// True if movement has been updated in some way. False otherwise. - public bool HandleMoveToTargetUpdate(ref Vector3 agent_control_v3) + public bool HandleMoveToTargetUpdate(double tolerance, ref Vector3 agent_control_v3) { // m_log.DebugFormat("[SCENE PRESENCE]: Called HandleMoveToTargetUpdate() for {0}", Name); @@ -1648,7 +1651,7 @@ namespace OpenSim.Region.Framework.Scenes // Name, AbsolutePosition, MoveToPositionTarget, distanceToTarget); // Check the error term of the current position in relation to the target position - if (distanceToTarget <= 1) + if (distanceToTarget <= tolerance) { // We are close enough to the target AbsolutePosition = MoveToPositionTarget; @@ -1824,7 +1827,7 @@ namespace OpenSim.Region.Framework.Scenes // m_log.DebugFormat("[SCENE PRESENCE]: Body rot for {0} set to {1}", Name, Rotation); Vector3 agent_control_v3 = new Vector3(); - HandleMoveToTargetUpdate(ref agent_control_v3); + HandleMoveToTargetUpdate(1, ref agent_control_v3); AddNewMovement(agent_control_v3); } From e74bf4600759c3fee6aa62ee808bbf214c019b6d Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 23 Feb 2012 23:18:01 +0100 Subject: [PATCH 6/6] Prevent a nullref when nonphysical motion objects cross sim boundaries --- OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index cf8637f19f..248d4c6b8e 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -582,7 +582,7 @@ namespace OpenSim.Region.Framework.Scenes foreach (ScenePresence av in m_linkedAvatars) { SceneObjectPart p = m_scene.GetSceneObjectPart(av.ParentID); - if (m_parts.TryGetValue(p.UUID, out p)) + if (p != null && m_parts.TryGetValue(p.UUID, out p)) { Vector3 offset = p.GetWorldPosition() - av.ParentPosition; av.AbsolutePosition += offset;