diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 1ac3b76350..f835e56f3d 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) { @@ -4837,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; } } @@ -4966,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; } } 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/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; diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index a3839c2501..26fa6c0bfa 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) @@ -984,6 +992,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 +1000,8 @@ namespace OpenSim.Region.Framework.Scenes } } + SendAvatarDataToAllAgents(); + // send the animations of the other presences to me m_scene.ForEachRootScenePresence(delegate(ScenePresence presence) { @@ -1084,7 +1095,7 @@ namespace OpenSim.Region.Framework.Scenes } /// - /// + /// Do not call this directly. Call Scene.RequestTeleportLocation() instead. /// /// public void Teleport(Vector3 pos) @@ -1558,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; } } @@ -1620,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); @@ -1637,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; @@ -1813,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); }