From 1d605642f78f46fed9e4cd38b117555717f87309 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 11 Dec 2013 23:59:52 +0000 Subject: Refix sitting on child prims by reinserting relevant code back into SP.HandleAgentSit() --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 25 +++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/ScenePresence.cs') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index edb8ca8..0282ad0 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -2868,14 +2868,33 @@ namespace OpenSim.Region.Framework.Scenes m_pos = sitTargetPos + sitOffset + SIT_TARGET_ADJUSTMENT; -// m_pos = sitTargetPos + SIT_TARGET_ADJUSTMENT - sitOffset; - Rotation = sitTargetOrient; + Vector3 newPos = sitTargetPos + sitOffset + SIT_TARGET_ADJUSTMENT; + Quaternion newRot; + + if (part.IsRoot) + { + newRot = sitTargetOrient; + } + else + { + newPos = newPos * part.RotationOffset; + newRot = part.RotationOffset * sitTargetOrient; + } + + newPos += part.OffsetPosition; + + m_pos = newPos; + Rotation = newRot; + // ParentPosition = part.AbsolutePosition; part.ParentGroup.AddAvatar(UUID); } else { - m_pos -= part.AbsolutePosition; + // An viewer expects to specify sit positions as offsets to the root prim, even if a child prim is + // being sat upon. + m_pos -= part.GroupPosition; + // ParentPosition = part.AbsolutePosition; part.ParentGroup.AddAvatar(UUID); -- cgit v1.1 From 11f177d6a88820c02547f916c39100a1c01e3bc1 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 13 Dec 2013 23:30:08 +0000 Subject: Eliminate unnecessary line from my previous commit 1d605642 --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 2 -- 1 file changed, 2 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/ScenePresence.cs') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 0282ad0..cf98ef2 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -2866,8 +2866,6 @@ namespace OpenSim.Region.Framework.Scenes Vector3 up = new Vector3((float)x, (float)y, (float)z); Vector3 sitOffset = up * Appearance.AvatarHeight * 0.02638f; - m_pos = sitTargetPos + sitOffset + SIT_TARGET_ADJUSTMENT; - Vector3 newPos = sitTargetPos + sitOffset + SIT_TARGET_ADJUSTMENT; Quaternion newRot; -- cgit v1.1