diff options
author | Justin Clark-Casey (justincc) | 2013-03-14 21:46:29 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2013-03-14 21:46:29 +0000 |
commit | ad9bd3fe93e3d48b17ca28b3e036fe39991f2203 (patch) | |
tree | e7571ad01e61b20c95258d5d15c2391b0cc19c8c /OpenSim/Region/ScriptEngine | |
parent | Make llGetObjectDetails() return the correct world rotation for a sitting avatar (diff) | |
download | opensim-SC_OLD-ad9bd3fe93e3d48b17ca28b3e036fe39991f2203.zip opensim-SC_OLD-ad9bd3fe93e3d48b17ca28b3e036fe39991f2203.tar.gz opensim-SC_OLD-ad9bd3fe93e3d48b17ca28b3e036fe39991f2203.tar.bz2 opensim-SC_OLD-ad9bd3fe93e3d48b17ca28b3e036fe39991f2203.tar.xz |
Fix sensors, llGetRootRotation(), llGet*Param() and other functions to use the world rotation if the avatar to which they are attached is sitting
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
3 files changed, 7 insertions, 10 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 47f8758..d88e416 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -2174,7 +2174,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2174 | if ((avatar.AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_MOUSELOOK) != 0) | 2174 | if ((avatar.AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_MOUSELOOK) != 0) |
2175 | q = avatar.CameraRotation; // Mouselook | 2175 | q = avatar.CameraRotation; // Mouselook |
2176 | else | 2176 | else |
2177 | q = avatar.Rotation; // Currently infrequently updated so may be inaccurate | 2177 | q = avatar.GetWorldRotation(); // Currently infrequently updated so may be inaccurate |
2178 | } | 2178 | } |
2179 | else | 2179 | else |
2180 | q = part.ParentGroup.GroupRotation; // Likely never get here but just in case | 2180 | q = part.ParentGroup.GroupRotation; // Likely never get here but just in case |
@@ -7831,7 +7831,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7831 | if ((avatar.AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_MOUSELOOK) != 0) | 7831 | if ((avatar.AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_MOUSELOOK) != 0) |
7832 | q = avatar.CameraRotation; // Mouselook | 7832 | q = avatar.CameraRotation; // Mouselook |
7833 | else | 7833 | else |
7834 | q = avatar.Rotation; // Currently infrequently updated so may be inaccurate | 7834 | q = avatar.GetWorldRotation(); // Currently infrequently updated so may be inaccurate |
7835 | else | 7835 | else |
7836 | q = m_host.ParentGroup.GroupRotation; // Likely never get here but just in case | 7836 | q = m_host.ParentGroup.GroupRotation; // Likely never get here but just in case |
7837 | } | 7837 | } |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 48c6b50..bd83f02 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -2578,18 +2578,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2578 | { | 2578 | { |
2579 | UUID npcId; | 2579 | UUID npcId; |
2580 | if (!UUID.TryParse(npc.m_string, out npcId)) | 2580 | if (!UUID.TryParse(npc.m_string, out npcId)) |
2581 | return new LSL_Rotation(Quaternion.Identity.X, Quaternion.Identity.Y, Quaternion.Identity.Z, Quaternion.Identity.W); | 2581 | return new LSL_Rotation(Quaternion.Identity); |
2582 | 2582 | ||
2583 | if (!npcModule.CheckPermissions(npcId, m_host.OwnerID)) | 2583 | if (!npcModule.CheckPermissions(npcId, m_host.OwnerID)) |
2584 | return new LSL_Rotation(Quaternion.Identity.X, Quaternion.Identity.Y, Quaternion.Identity.Z, Quaternion.Identity.W); | 2584 | return new LSL_Rotation(Quaternion.Identity); |
2585 | 2585 | ||
2586 | ScenePresence sp = World.GetScenePresence(npcId); | 2586 | ScenePresence sp = World.GetScenePresence(npcId); |
2587 | 2587 | ||
2588 | if (sp != null) | 2588 | if (sp != null) |
2589 | { | 2589 | return new LSL_Rotation(sp.GetWorldRotation()); |
2590 | Quaternion rot = sp.Rotation; | ||
2591 | return new LSL_Rotation(rot.X, rot.Y, rot.Z, rot.W); | ||
2592 | } | ||
2593 | } | 2590 | } |
2594 | 2591 | ||
2595 | return new LSL_Rotation(Quaternion.Identity.X, Quaternion.Identity.Y, Quaternion.Identity.Z, Quaternion.Identity.W); | 2592 | return new LSL_Rotation(Quaternion.Identity.X, Quaternion.Identity.Y, Quaternion.Identity.Z, Quaternion.Identity.W); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs index dd45406..88ab515 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs | |||
@@ -353,7 +353,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins | |||
353 | // Position of a sensor in a child prim attached to an avatar | 353 | // Position of a sensor in a child prim attached to an avatar |
354 | // will be still wrong. | 354 | // will be still wrong. |
355 | ScenePresence avatar = m_CmdManager.m_ScriptEngine.World.GetScenePresence(SensePoint.ParentGroup.AttachedAvatar); | 355 | ScenePresence avatar = m_CmdManager.m_ScriptEngine.World.GetScenePresence(SensePoint.ParentGroup.AttachedAvatar); |
356 | q = avatar.Rotation * q; | 356 | q = avatar.GetWorldRotation() * q; |
357 | } | 357 | } |
358 | 358 | ||
359 | LSL_Types.Quaternion r = new LSL_Types.Quaternion(q); | 359 | LSL_Types.Quaternion r = new LSL_Types.Quaternion(q); |
@@ -480,7 +480,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins | |||
480 | // Position of a sensor in a child prim attached to an avatar | 480 | // Position of a sensor in a child prim attached to an avatar |
481 | // will be still wrong. | 481 | // will be still wrong. |
482 | ScenePresence avatar = m_CmdManager.m_ScriptEngine.World.GetScenePresence(SensePoint.ParentGroup.AttachedAvatar); | 482 | ScenePresence avatar = m_CmdManager.m_ScriptEngine.World.GetScenePresence(SensePoint.ParentGroup.AttachedAvatar); |
483 | q = avatar.Rotation * q; | 483 | q = avatar.GetWorldRotation() * q; |
484 | } | 484 | } |
485 | 485 | ||
486 | LSL_Types.Quaternion r = new LSL_Types.Quaternion(q); | 486 | LSL_Types.Quaternion r = new LSL_Types.Quaternion(q); |