Patch by Apelsin that fixes behaviour of llSetPos and llGetLocalPos for attachments.

This fixes Mantis #3923.

Signed-off-by: Melanie <melanie@t-data.com>
0.7.0.2-release
Marck 2010-08-24 10:33:50 +02:00 committed by Diva Canto
parent 4f63edaa72
commit be07063102
1 changed files with 17 additions and 8 deletions

View File

@ -1926,7 +1926,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (part.ParentGroup.RootPart == part) 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; targetPos.z = ground;
SceneObjectGroup parent = part.ParentGroup; SceneObjectGroup parent = part.ParentGroup;
LSL_Vector real_vec = SetPosAdjust(currentPos, targetPos); LSL_Vector real_vec = SetPosAdjust(currentPos, targetPos);
@ -1958,17 +1958,26 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
protected LSL_Vector GetPartLocalPos(SceneObjectPart part) protected LSL_Vector GetPartLocalPos(SceneObjectPart part)
{ {
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
if (part.ParentID != 0) 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, return new LSL_Vector(part.OffsetPosition.X,
part.OffsetPosition.Y, part.OffsetPosition.Y,
part.OffsetPosition.Z); part.OffsetPosition.Z);
} }
else
{
return new LSL_Vector(part.AbsolutePosition.X,
part.AbsolutePosition.Y,
part.AbsolutePosition.Z);
} }
} }