public LSL_Rotation llGetRootRotation()
{
if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID)) return new LSL_Rotation();
Quaternion q;
if (m_host.ParentEntity.RootChild.AttachmentPoint != 0)
{
IScenePresence avatar = World.GetScenePresence(m_host.AttachedAvatar);
if (avatar != null)
q = (avatar.AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_MOUSELOOK) != 0
? avatar.CameraRotation
: avatar.Rotation;
else
q = m_host.ParentEntity.GroupRotation; // Likely never get here but just in case
}
else
q = m_host.ParentEntity.GroupRotation; // just the group rotation
return new LSL_Rotation(q.X, q.Y, q.Z, q.W);
}