Fix llGetLinkPrimParams for PRIM_POS_LOCAL for child prims whether in scene or attachments.

Return relative position to root prim rather than 0,0,0.
Should fix same issue with llGetLocalPos()
http://opensimulator.org/mantis/view.php?id=5951
integration
Justin Clark-Casey (justincc) 2012-04-06 22:41:35 +01:00
parent 47108bb351
commit 3af1cd65f9
2 changed files with 24 additions and 13 deletions

View File

@ -125,9 +125,11 @@ namespace OpenSim.Region.Framework.Scenes
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
/// <value> /// <value>
/// Is this sop a root part? /// Is this a root part?
/// </value> /// </value>
/// <remarks>
/// This will return true even if the whole object is attached to an avatar.
/// </remarks>
public bool IsRoot public bool IsRoot
{ {
get { return ParentGroup.RootPart == this; } get { return ParentGroup.RootPart == this; }
@ -1112,6 +1114,14 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
/// <summary>
/// The parent ID of this part.
/// </summary>
/// <remarks>
/// If this is a root part which is not attached to an avatar then the value will be 0.
/// If this is a root part which is attached to an avatar then the value is the local id of that avatar.
/// If this is a child part then the value is the local ID of the root part.
/// </remarks>
public uint ParentID public uint ParentID
{ {
get { return _parentID; } get { return _parentID; }

View File

@ -2022,27 +2022,28 @@ 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);
Vector3 pos;
if (part.ParentID == 0) if (part.ParentID == 0)
{ {
return new LSL_Vector(part.AbsolutePosition.X, pos = part.AbsolutePosition;
part.AbsolutePosition.Y,
part.AbsolutePosition.Z);
} }
else else
{ {
if (m_host.IsRoot) if (part.IsRoot)
{ {
return new LSL_Vector(m_host.AttachedPos.X, pos = part.AttachedPos;
m_host.AttachedPos.Y,
m_host.AttachedPos.Z);
} }
else else
{ {
return new LSL_Vector(part.OffsetPosition.X, pos = part.OffsetPosition;
part.OffsetPosition.Y,
part.OffsetPosition.Z);
} }
} }
// m_log.DebugFormat("[LSL API]: Returning {0} in GetPartLocalPos()", pos);
return new LSL_Vector(pos.X, pos.Y, pos.Z);
} }
public void llSetRot(LSL_Rotation rot) public void llSetRot(LSL_Rotation rot)