Fix sensors, llGetRootRotation(), llGet*Param() and other functions to use the world rotation if the avatar to which they are attached is sitting

user_profiles
Justin Clark-Casey (justincc) 2013-03-14 21:46:29 +00:00
parent e9c394fb4e
commit ad9bd3fe93
3 changed files with 7 additions and 10 deletions

View File

@ -2174,7 +2174,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if ((avatar.AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_MOUSELOOK) != 0)
q = avatar.CameraRotation; // Mouselook
else
q = avatar.Rotation; // Currently infrequently updated so may be inaccurate
q = avatar.GetWorldRotation(); // Currently infrequently updated so may be inaccurate
}
else
q = part.ParentGroup.GroupRotation; // Likely never get here but just in case
@ -7831,7 +7831,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if ((avatar.AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_MOUSELOOK) != 0)
q = avatar.CameraRotation; // Mouselook
else
q = avatar.Rotation; // Currently infrequently updated so may be inaccurate
q = avatar.GetWorldRotation(); // Currently infrequently updated so may be inaccurate
else
q = m_host.ParentGroup.GroupRotation; // Likely never get here but just in case
}

View File

@ -2578,18 +2578,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
UUID npcId;
if (!UUID.TryParse(npc.m_string, out npcId))
return new LSL_Rotation(Quaternion.Identity.X, Quaternion.Identity.Y, Quaternion.Identity.Z, Quaternion.Identity.W);
return new LSL_Rotation(Quaternion.Identity);
if (!npcModule.CheckPermissions(npcId, m_host.OwnerID))
return new LSL_Rotation(Quaternion.Identity.X, Quaternion.Identity.Y, Quaternion.Identity.Z, Quaternion.Identity.W);
return new LSL_Rotation(Quaternion.Identity);
ScenePresence sp = World.GetScenePresence(npcId);
if (sp != null)
{
Quaternion rot = sp.Rotation;
return new LSL_Rotation(rot.X, rot.Y, rot.Z, rot.W);
}
return new LSL_Rotation(sp.GetWorldRotation());
}
return new LSL_Rotation(Quaternion.Identity.X, Quaternion.Identity.Y, Quaternion.Identity.Z, Quaternion.Identity.W);

View File

@ -353,7 +353,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
// Position of a sensor in a child prim attached to an avatar
// will be still wrong.
ScenePresence avatar = m_CmdManager.m_ScriptEngine.World.GetScenePresence(SensePoint.ParentGroup.AttachedAvatar);
q = avatar.Rotation * q;
q = avatar.GetWorldRotation() * q;
}
LSL_Types.Quaternion r = new LSL_Types.Quaternion(q);
@ -480,7 +480,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
// Position of a sensor in a child prim attached to an avatar
// will be still wrong.
ScenePresence avatar = m_CmdManager.m_ScriptEngine.World.GetScenePresence(SensePoint.ParentGroup.AttachedAvatar);
q = avatar.Rotation * q;
q = avatar.GetWorldRotation() * q;
}
LSL_Types.Quaternion r = new LSL_Types.Quaternion(q);