diff options
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 28 |
1 files changed, 27 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 2dbbf70..16dd834 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -1978,6 +1978,32 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1978 | return new LSL_Rotation(q.X, q.Y, q.Z, q.W); | 1978 | return new LSL_Rotation(q.X, q.Y, q.Z, q.W); |
1979 | } | 1979 | } |
1980 | 1980 | ||
1981 | private LSL_Rotation GetPartRot(SceneObjectPart part) | ||
1982 | { | ||
1983 | Quaternion q; | ||
1984 | if (part.LinkNum == 0 || part.LinkNum == 1) // unlinked or root prim | ||
1985 | { | ||
1986 | if (part.ParentGroup.RootPart.AttachmentPoint != 0) | ||
1987 | { | ||
1988 | ScenePresence avatar = World.GetScenePresence(part.AttachedAvatar); | ||
1989 | if (avatar != null) | ||
1990 | { | ||
1991 | if ((avatar.AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_MOUSELOOK) != 0) | ||
1992 | q = avatar.CameraRotation; // Mouselook | ||
1993 | else | ||
1994 | q = avatar.Rotation; // Currently infrequently updated so may be inaccurate | ||
1995 | } | ||
1996 | else | ||
1997 | q = part.ParentGroup.GroupRotation; // Likely never get here but just in case | ||
1998 | } | ||
1999 | else | ||
2000 | q = part.ParentGroup.GroupRotation; // just the group rotation | ||
2001 | return new LSL_Rotation(q.X, q.Y, q.Z, q.W); | ||
2002 | } | ||
2003 | q = part.GetWorldRotation(); | ||
2004 | return new LSL_Rotation(q.X, q.Y, q.Z, q.W); | ||
2005 | } | ||
2006 | |||
1981 | public LSL_Rotation llGetLocalRot() | 2007 | public LSL_Rotation llGetLocalRot() |
1982 | { | 2008 | { |
1983 | m_host.AddScriptLPS(1); | 2009 | m_host.AddScriptLPS(1); |
@@ -7299,7 +7325,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7299 | break; | 7325 | break; |
7300 | 7326 | ||
7301 | case (int)ScriptBaseClass.PRIM_ROTATION: | 7327 | case (int)ScriptBaseClass.PRIM_ROTATION: |
7302 | res.Add(llGetRot()); | 7328 | res.Add(GetPartRot(part)); |
7303 | break; | 7329 | break; |
7304 | 7330 | ||
7305 | case (int)ScriptBaseClass.PRIM_TYPE: | 7331 | case (int)ScriptBaseClass.PRIM_TYPE: |