OpenSim.Region.ScriptEngine.Shared.Api.LSL_Api.SetRot C# (CSharp) Method

SetRot() protected method

protected SetRot ( SceneObjectPart part, Quaternion rot ) : void
part OpenSim.Region.Framework.Scenes.SceneObjectPart
rot Quaternion
return void
        protected void SetRot(SceneObjectPart part, Quaternion rot)
        {
            if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
                return;

            bool isroot = (part == part.ParentGroup.RootPart);
            bool isphys;

            PhysicsActor pa = part.PhysActor;

            // keep using physactor ideia of isphysical
            // it should be SOP ideia of that
            // not much of a issue with ubOde
            if (pa != null && pa.IsPhysical)
                isphys = true;
            else
                isphys = false;

            // SL doesn't let scripts rotate root of physical linksets
            if (isroot && isphys)
                return;

            part.UpdateRotation(rot);

            // Update rotation does not move the object in the physics engine if it's a non physical linkset
            // so do a nasty update of parts positions if is a root part rotation
            if (isroot && pa != null) // with if above implies non physical  root part
            {
                part.ParentGroup.ResetChildPrimPhysicsPositions();
            }
            else // fix sitting avatars. This is only needed bc of how we link avas to child parts, not root part
            {
                //                List<ScenePresence> sittingavas = part.ParentGroup.GetLinkedAvatars();
                List<ScenePresence> sittingavas = part.ParentGroup.GetSittingAvatars();
                if (sittingavas.Count > 0)
                {
                    foreach (ScenePresence av in sittingavas)
                    {
                        if (isroot || part.LocalId == av.ParentID)
                            av.SendTerseUpdateToAllClients();
                    }
                }
            }
        }
LSL_Api