From 36d146bf272f33eb54de80579b163f27f2703fd4 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Tue, 26 Nov 2013 00:43:35 +0000 Subject: [PATCH] fix position changes when sitting on a prim with position and/or orientation explicitly specified --- .../Region/Framework/Scenes/ScenePresence.cs | 31 +++++++++++++++++-- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 7a1017f975..42a9b4d8dd 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -2267,7 +2267,6 @@ namespace OpenSim.Region.Framework.Scenes m_sitAvatarHeight = PhysicsActor.Size.Z; bool canSit = false; - Vector3 pos = part.AbsolutePosition + offset; if (part.IsSitTargetSet && part.SitTargetAvatar == UUID.Zero) { @@ -2277,10 +2276,24 @@ namespace OpenSim.Region.Framework.Scenes offset = part.SitTargetPosition; sitOrientation = part.SitTargetOrientation; + +// m_log.DebugFormat("Old sit orient {0}", sitOrientation); + if (part.IsRoot) + sitOrientation = sitOrientation; + else + sitOrientation = part.RotationOffset * sitOrientation; +// m_log.DebugFormat("New sit orient {0}", sitOrientation); + +// m_log.DebugFormat("Old sit offset {0}", offset); + offset = offset * sitOrientation; +// m_log.DebugFormat("New sit offset {0}", offset); + canSit = true; } else { + Vector3 pos = part.AbsolutePosition + offset; + if (Util.GetDistanceTo(AbsolutePosition, pos) <= 10) { // m_log.DebugFormat( @@ -2590,8 +2603,20 @@ namespace OpenSim.Region.Framework.Scenes //Quaternion result = (sitTargetOrient * vq) * nq; - m_pos = sitTargetPos + SIT_TARGET_ADJUSTMENT + part.OffsetPosition; - Rotation = part.RotationOffset * sitTargetOrient; + Vector3 newPos = sitTargetPos + SIT_TARGET_ADJUSTMENT; + + if (part.IsRoot) + Rotation = sitTargetOrient; + else + Rotation = part.RotationOffset * sitTargetOrient; + +// m_log.DebugFormat("Old offset2 {0}", newPos); + newPos = newPos * Rotation; +// m_log.DebugFormat("New offset2 {0}", newPos); + + newPos += part.OffsetPosition; + + m_pos = newPos; ParentPosition = part.AbsolutePosition; } else