aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-04-06 22:41:35 +0100
committerJustin Clark-Casey (justincc)2012-04-06 22:41:35 +0100
commit3af1cd65f91db87778096196bfd985dc48c72d87 (patch)
treeca8e542edc80688286e0aa9ca8b7326c1af06add /OpenSim
parentMerge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff)
downloadopensim-SC_OLD-3af1cd65f91db87778096196bfd985dc48c72d87.zip
opensim-SC_OLD-3af1cd65f91db87778096196bfd985dc48c72d87.tar.gz
opensim-SC_OLD-3af1cd65f91db87778096196bfd985dc48c72d87.tar.bz2
opensim-SC_OLD-3af1cd65f91db87778096196bfd985dc48c72d87.tar.xz
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
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs16
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs21
2 files changed, 24 insertions, 13 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 9e65f5d..5ec0ed9 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -125,12 +125,14 @@ namespace OpenSim.Region.Framework.Scenes
125 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 125 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
126 126
127 /// <value> 127 /// <value>
128 /// Is this sop a root part? 128 /// Is this a root part?
129 /// </value> 129 /// </value>
130 130 /// <remarks>
131 /// This will return true even if the whole object is attached to an avatar.
132 /// </remarks>
131 public bool IsRoot 133 public bool IsRoot
132 { 134 {
133 get { return ParentGroup.RootPart == this; } 135 get { return ParentGroup.RootPart == this; }
134 } 136 }
135 137
136 #region Fields 138 #region Fields
@@ -1112,6 +1114,14 @@ namespace OpenSim.Region.Framework.Scenes
1112 } 1114 }
1113 } 1115 }
1114 1116
1117 /// <summary>
1118 /// The parent ID of this part.
1119 /// </summary>
1120 /// <remarks>
1121 /// If this is a root part which is not attached to an avatar then the value will be 0.
1122 /// If this is a root part which is attached to an avatar then the value is the local id of that avatar.
1123 /// If this is a child part then the value is the local ID of the root part.
1124 /// </remarks>
1115 public uint ParentID 1125 public uint ParentID
1116 { 1126 {
1117 get { return _parentID; } 1127 get { return _parentID; }
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index a85a36e..ad73f47 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -2022,27 +2022,28 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2022 protected LSL_Vector GetPartLocalPos(SceneObjectPart part) 2022 protected LSL_Vector GetPartLocalPos(SceneObjectPart part)
2023 { 2023 {
2024 m_host.AddScriptLPS(1); 2024 m_host.AddScriptLPS(1);
2025
2026 Vector3 pos;
2027
2025 if (part.ParentID == 0) 2028 if (part.ParentID == 0)
2026 { 2029 {
2027 return new LSL_Vector(part.AbsolutePosition.X, 2030 pos = part.AbsolutePosition;
2028 part.AbsolutePosition.Y,
2029 part.AbsolutePosition.Z);
2030 } 2031 }
2031 else 2032 else
2032 { 2033 {
2033 if (m_host.IsRoot) 2034 if (part.IsRoot)
2034 { 2035 {
2035 return new LSL_Vector(m_host.AttachedPos.X, 2036 pos = part.AttachedPos;
2036 m_host.AttachedPos.Y,
2037 m_host.AttachedPos.Z);
2038 } 2037 }
2039 else 2038 else
2040 { 2039 {
2041 return new LSL_Vector(part.OffsetPosition.X, 2040 pos = part.OffsetPosition;
2042 part.OffsetPosition.Y,
2043 part.OffsetPosition.Z);
2044 } 2041 }
2045 } 2042 }
2043
2044// m_log.DebugFormat("[LSL API]: Returning {0} in GetPartLocalPos()", pos);
2045
2046 return new LSL_Vector(pos.X, pos.Y, pos.Z);
2046 } 2047 }
2047 2048
2048 public void llSetRot(LSL_Rotation rot) 2049 public void llSetRot(LSL_Rotation rot)