コード例 #1
0
        public void PlayfwdState(ISceneChildEntity part)
        {
            if (part != null)
            {
                bool ChangedScale = false;
                bool ChangedRot   = false;
                bool ChangedPos   = false;
                part.Undoing = true;

                if (part.UUID == part.ParentEntity.UUID)
                {
                    if (Position != Vector3.Zero)
                    {
                        ChangedPos = true;
                        part.ParentEntity.AbsolutePosition = Position;
                    }
                    if (Rotation != Quaternion.Identity)
                    {
                        ChangedRot = true;
                        part.UpdateRotation(Rotation);
                    }
                    if (Scale != Vector3.Zero)
                    {
                        ChangedScale = true;
                        part.Resize(Scale);
                    }

                    foreach (
                        ISceneChildEntity child in
                        part.ParentEntity.ChildrenEntities().Where(child => child.UUID != part.UUID))
                    {
                        child.Redo(); //No updates here, child redo will do it on their own
                    }
                }
                else
                {
                    if (Position != Vector3.Zero)
                    {
                        ChangedPos = true;
                        part.FixOffsetPosition(Position, false);
                    }
                    if (Rotation != Quaternion.Identity)
                    {
                        ChangedRot = true;
                        part.ParentEntity.Rotation = (Rotation);
                    }
                    if (Scale != Vector3.Zero)
                    {
                        ChangedScale = true;
                        part.Resize(Scale);
                    }
                }

                part.ScheduleUpdate((ChangedScale ? PrimUpdateFlags.Shape : PrimUpdateFlags.None) |
                                    (ChangedPos ? PrimUpdateFlags.Position : PrimUpdateFlags.None) |
                                    (ChangedRot ? PrimUpdateFlags.Rotation : PrimUpdateFlags.None));
                part.Undoing = false;
            }
        }
コード例 #2
0
        public void PlaybackState(ISceneChildEntity part)
        {
            if (part != null)
            {
                part.Undoing = true;

                bool ChangedScale = false;
                bool ChangedPos   = false;

                if (part.UUID == part.ParentEntity.UUID)
                {
                    if (Position != Vector3.Zero)
                    {
                        ChangedPos = true;
                        part.ParentEntity.AbsolutePosition = Position;
                    }
                    part.SetRotationOffset(true, Rotation, true);
                    if (Scale != Vector3.Zero)
                    {
                        ChangedScale = true;
                        part.Scale   = Scale;
                    }

                    foreach (
                        ISceneChildEntity child in
                        part.ParentEntity.ChildrenEntities().Where(child => child.UUID != part.UUID))
                    {
                        child.Undo();  //No updates here, child undo will do it on their own
                    }
                }
                else
                {
                    if (Position != Vector3.Zero)
                    {
                        ChangedPos = true;
                        part.FixOffsetPosition(Position, false);
                    }
                    part.UpdateRotation(Rotation);
                    if (Scale != Vector3.Zero)
                    {
                        ChangedScale = true;
                        part.Resize(Scale);
                    }
                }
                part.Undoing = false;
                var updateFlags =
                    (ChangedScale ? PrimUpdateFlags.Shape : PrimUpdateFlags.None) |
                    (ChangedPos ? PrimUpdateFlags.Position : PrimUpdateFlags.None) |
                    PrimUpdateFlags.Rotation;

                part.ScheduleUpdate(updateFlags);
            }
        }
コード例 #3
0
        public void PlayfwdState(ISceneChildEntity part)
        {
            if (part != null)
            {
                bool ChangedScale = false;
                bool ChangedRot = false;
                bool ChangedPos = false;
                part.Undoing = true;

                if (part.UUID == part.ParentEntity.UUID)
                {
                    if (Position != Vector3.Zero)
                    {
                        ChangedPos = true;
                        part.ParentEntity.AbsolutePosition = Position;
                    }
                    if (Rotation != Quaternion.Identity)
                    {
                        ChangedRot = true;
                        part.UpdateRotation(Rotation);
                    }
                    if (Scale != Vector3.Zero)
                    {
                        ChangedScale = true;
                        part.Resize(Scale);
                    }

                    foreach (
                        ISceneChildEntity child in
                            part.ParentEntity.ChildrenEntities().Where(child => child.UUID != part.UUID))
                    {
                        child.Redo(); //No updates here, child redo will do it on their own
                    }
                }
                else
                {
                    if (Position != Vector3.Zero)
                    {
                        ChangedPos = true;
                        part.FixOffsetPosition(Position, false);
                    }
                    if (Rotation != Quaternion.Identity)
                    {
                        ChangedRot = true;
                        part.ParentEntity.Rotation = (Rotation);
                    }
                    if (Scale != Vector3.Zero)
                    {
                        ChangedScale = true;
                        part.Resize(Scale);
                    }
                }

                part.ScheduleUpdate((ChangedScale ? PrimUpdateFlags.Shape : PrimUpdateFlags.None) |
                                    (ChangedPos ? PrimUpdateFlags.Position : PrimUpdateFlags.None) |
                                    (ChangedRot ? PrimUpdateFlags.Rotation : PrimUpdateFlags.None));
                part.Undoing = false;
            }
        }
コード例 #4
0
ファイル: LSL_Api.cs プロジェクト: rknop/Aurora-Sim
        protected void SetPos(ISceneChildEntity part, LSL_Vector targetPos)
        {
            // Capped movemment if distance > 10m (http://wiki.secondlife.com/wiki/LlSetPos)
            LSL_Vector currentPos = GetPartLocalPos(part);
            float ground = 0;
            bool disable_underground_movement = m_ScriptEngine.Config.GetBoolean("DisableUndergroundMovement", true);

            ITerrainChannel heightmap = World.RequestModuleInterface<ITerrainChannel>();
            if(heightmap != null)
                ground = heightmap.GetNormalizedGroundHeight((int)(float)targetPos.x, (int)(float)targetPos.y);
            if (part.ParentEntity == null)
            {
                if (ground != 0 && (targetPos.z < ground) && disable_underground_movement && m_host.AttachmentPoint == 0)
                    targetPos.z = ground;
                    LSL_Vector real_vec = SetPosAdjust(currentPos, targetPos);
                    part.UpdateOffSet(new Vector3((float)real_vec.x, (float)real_vec.y, (float)real_vec.z));
            }
            else if (part.ParentEntity.RootChild == part)
            {
                ISceneEntity parent = part.ParentEntity;
                if (!part.IsAttachment)
                {
                    if (ground != 0 && (targetPos.z < ground) && disable_underground_movement)
                        targetPos.z = ground;
                }
                LSL_Vector real_vec = SetPosAdjust(currentPos, targetPos);
                parent.UpdateGroupPosition(new Vector3((float)real_vec.x, (float)real_vec.y, (float)real_vec.z), true);
            }
            else
            {
                LSL_Vector rel_vec = SetPosAdjust(currentPos, targetPos);
                part.FixOffsetPosition((new Vector3((float)rel_vec.x, (float)rel_vec.y, (float)rel_vec.z)),true);
                ISceneEntity parent = part.ParentEntity;
                parent.ScheduleGroupTerseUpdate();
            }
        }
コード例 #5
0
        public void PlaybackState (ISceneChildEntity part)
        {
            if (part != null) {
                part.Undoing = true;

                bool ChangedScale = false;
                bool ChangedPos = false;

                if (part.UUID == part.ParentEntity.UUID) {
                    if (Position != Vector3.Zero) {
                        ChangedPos = true;
                        part.ParentEntity.AbsolutePosition = Position;
                    }
                    part.SetRotationOffset (true, Rotation, true);
                    if (Scale != Vector3.Zero) {
                        ChangedScale = true;
                        part.Scale = Scale;
                    }

                    foreach (
                        ISceneChildEntity child in
                            part.ParentEntity.ChildrenEntities ().Where (child => child.UUID != part.UUID)) {
                        child.Undo (); //No updates here, child undo will do it on their own
                    }
                } else {
                    if (Position != Vector3.Zero) {
                        ChangedPos = true;
                        part.FixOffsetPosition (Position, false);
                    }
                    part.UpdateRotation (Rotation);
                    if (Scale != Vector3.Zero) {
                        ChangedScale = true;
                        part.Resize (Scale);
                    }
                }
                part.Undoing = false;
                var updateFlags =
                    (ChangedScale ? PrimUpdateFlags.Shape : PrimUpdateFlags.None) |
                    (ChangedPos ? PrimUpdateFlags.Position : PrimUpdateFlags.None) |
                    PrimUpdateFlags.Rotation;

                part.ScheduleUpdate (updateFlags);
            }
        }