From a7a45cb22cd0488d89fa6ca53757a21188d6842f Mon Sep 17 00:00:00 2001 From: Marck Date: Tue, 24 Aug 2010 10:33:50 +0200 Subject: Patch by Apelsin that fixes behaviour of llSetPos and llGetLocalPos for attachments. This fixes Mantis #3923. Signed-off-by: Melanie --- .../Shared/Api/Implementation/LSL_Api.cs | 25 +++++++++++++++------- 1 file changed, 17 insertions(+), 8 deletions(-) (limited to 'OpenSim/Region/ScriptEngine') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index dc43e45..21604d0 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -1936,7 +1936,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (part.ParentGroup.RootPart == part) { - if ((targetPos.z < ground) && disable_underground_movement) + if ((targetPos.z < ground) && disable_underground_movement && m_host.AttachmentPoint == 0) targetPos.z = ground; SceneObjectGroup parent = part.ParentGroup; LSL_Vector real_vec = SetPosAdjust(currentPos, targetPos); @@ -1968,18 +1968,27 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api protected LSL_Vector GetPartLocalPos(SceneObjectPart part) { m_host.AddScriptLPS(1); - if (part.ParentID != 0) - { - return new LSL_Vector(part.OffsetPosition.X, - part.OffsetPosition.Y, - part.OffsetPosition.Z); - } - else + if (part.ParentID == 0) { return new LSL_Vector(part.AbsolutePosition.X, part.AbsolutePosition.Y, part.AbsolutePosition.Z); } + else + { + if (m_host.IsRoot) + { + return new LSL_Vector(m_host.AttachedPos.X, + m_host.AttachedPos.Y, + m_host.AttachedPos.Z); + } + else + { + return new LSL_Vector(part.OffsetPosition.X, + part.OffsetPosition.Y, + part.OffsetPosition.Z); + } + } } public void llSetRot(LSL_Rotation rot) -- cgit v1.1