Пример #1
0
        void MoveSelection(double x, double y, double z)
        {
            if (SelectedItem == null)
            {
                return;
            }
            double mult = MKeyboardHandler.GetMinifier();

            // complete any pending transitions
            MMoveSync ms = (MMoveSync)SelectedItem.FindModuleByType(MObject.EType.MoveSync);

            if (ms != null)
            {
                ms.Complete();
            }

            Vector3d v = SelectedItem.transform.Position
                         + SelectedItem.transform.Right() * x * mult
                         + SelectedItem.transform.Forward() * y * mult
                         + SelectedItem.transform.Up() * z * mult;

            MMessageBus.MoveRequest(this, SelectedItem.InstanceID, v, SelectedItem.transform.Rotation);
        }
Пример #2
0
        void RotateSelection(double x, double y, double z)
        {
            if (SelectedItem == null)
            {
                return;
            }
            double mult = MKeyboardHandler.GetRotationMinifier();

            x = MathHelper.DegreesToRadians(x * mult);
            y = MathHelper.DegreesToRadians(y * mult);
            z = MathHelper.DegreesToRadians(z * mult);

            // complete any pending transitions
            MMoveSync ms = (MMoveSync)SelectedItem.FindModuleByType(MObject.EType.MoveSync);

            if (ms != null)
            {
                ms.Complete();
            }

            Quaterniond rot = SelectedItem.transform.Rotation * Quaterniond.FromEulerAngles(x, y, z);

            MMessageBus.MoveRequest(this, SelectedItem.InstanceID, SelectedItem.transform.Position, rot);
        }