diff options
author | Charles Krinke | 2008-10-27 00:51:50 +0000 |
---|---|---|
committer | Charles Krinke | 2008-10-27 00:51:50 +0000 |
commit | 8a6042f063f24c6d9cf39d75159050bc20dd2e0a (patch) | |
tree | b565350d56e95c8236185ae6115fb6e94be6958d /OpenSim | |
parent | Thank you kindly, Ruud Lathrop for a patch that solves: (diff) | |
download | opensim-SC-8a6042f063f24c6d9cf39d75159050bc20dd2e0a.zip opensim-SC-8a6042f063f24c6d9cf39d75159050bc20dd2e0a.tar.gz opensim-SC-8a6042f063f24c6d9cf39d75159050bc20dd2e0a.tar.bz2 opensim-SC-8a6042f063f24c6d9cf39d75159050bc20dd2e0a.tar.xz |
Thank you kindly, Idb for a patch that solves:
llGetRot and llGetRootRotation return the wrong
values when the object is attached
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 55e370f..847004d 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -1790,6 +1790,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1790 | 1790 | ||
1791 | public LSL_Rotation llGetRot() | 1791 | public LSL_Rotation llGetRot() |
1792 | { | 1792 | { |
1793 | // unlinked or root prim then use llRootRotation | ||
1794 | // see llRootRotaion for references. | ||
1795 | if (m_host.LinkNum == 0 || m_host.LinkNum == 1) | ||
1796 | { | ||
1797 | return llGetRootRotation(); | ||
1798 | } | ||
1793 | m_host.AddScriptLPS(1); | 1799 | m_host.AddScriptLPS(1); |
1794 | Quaternion q = m_host.RotationOffset; | 1800 | Quaternion q = m_host.RotationOffset; |
1795 | return new LSL_Rotation(q.X, q.Y, q.Z, q.W); | 1801 | return new LSL_Rotation(q.X, q.Y, q.Z, q.W); |
@@ -6416,10 +6422,33 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6416 | return new LSL_Vector(m_host.ParentGroup.AbsolutePosition.X, m_host.ParentGroup.AbsolutePosition.Y, m_host.ParentGroup.AbsolutePosition.Z); | 6422 | return new LSL_Vector(m_host.ParentGroup.AbsolutePosition.X, m_host.ParentGroup.AbsolutePosition.Y, m_host.ParentGroup.AbsolutePosition.Z); |
6417 | } | 6423 | } |
6418 | 6424 | ||
6425 | /// <summary> | ||
6426 | /// http://lslwiki.net/lslwiki/wakka.php?wakka=llGetRot | ||
6427 | /// http://lslwiki.net/lslwiki/wakka.php?wakka=ChildRotation | ||
6428 | /// Also tested in sl in regards to the behaviour in attachments/mouselook | ||
6429 | /// In the root prim:- | ||
6430 | /// Returns the object rotation if not attached | ||
6431 | /// Returns the avatars rotation if attached | ||
6432 | /// Returns the camera rotation if attached and the avatar is in mouselook | ||
6433 | /// </summary> | ||
6419 | public LSL_Rotation llGetRootRotation() | 6434 | public LSL_Rotation llGetRootRotation() |
6420 | { | 6435 | { |
6421 | m_host.AddScriptLPS(1); | 6436 | m_host.AddScriptLPS(1); |
6422 | return new LSL_Rotation(m_host.ParentGroup.GroupRotation.X, m_host.ParentGroup.GroupRotation.Y, m_host.ParentGroup.GroupRotation.Z, m_host.ParentGroup.GroupRotation.W); | 6437 | Quaternion q; |
6438 | if (m_host.ParentGroup.RootPart.AttachmentPoint != 0) | ||
6439 | { | ||
6440 | ScenePresence avatar = World.GetScenePresence(m_host.AttachedAvatar); | ||
6441 | if (avatar != null) | ||
6442 | if ((avatar.AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_MOUSELOOK) != 0) | ||
6443 | q = avatar.CameraRotation; // Mouselook | ||
6444 | else | ||
6445 | q = avatar.Rotation; // Currently infrequently updated so may be inaccurate | ||
6446 | else | ||
6447 | q = m_host.ParentGroup.GroupRotation; // Likely never get here but just in case | ||
6448 | } | ||
6449 | else | ||
6450 | q = m_host.ParentGroup.GroupRotation; // just the group rotation | ||
6451 | return new LSL_Rotation(q.X, q.Y, q.Z, q.W); | ||
6423 | } | 6452 | } |
6424 | 6453 | ||
6425 | public LSL_String llGetObjectDesc() | 6454 | public LSL_String llGetObjectDesc() |