Beispiel #1
0
        public void RotateUsingKeyboardSettings(TransformAxis rotationAxis)
        {
            if (IsAnyMouseSessionActive)
            {
                return;
            }

            ObjectKeyboardRotationSettings keyboardRotationSettings = ObjectPlacementGuideSettings.Get().KeyboardRotationSettings;

            UndoEx.RecordForToolAction(_transform);

            AxisKeyboardRotationSettings axisKeyboardRotationSettings = keyboardRotationSettings.XAxisRotationSettings;

            if (rotationAxis == TransformAxis.Y)
            {
                axisKeyboardRotationSettings = keyboardRotationSettings.YAxisRotationSettings;
            }
            else if (rotationAxis == TransformAxis.Z)
            {
                axisKeyboardRotationSettings = keyboardRotationSettings.XAxisRotationSettings;
            }

            gameObject.RotateHierarchyBoxAroundPoint(axisKeyboardRotationSettings.RotationAmountInDegrees,
                                                     TransformAxes.GetVector(rotationAxis, TransformSpace.Global, _transform),
                                                     gameObject.GetHierarchyWorldOrientedBox().Center);

            UndoEx.RecordForToolAction(_sourcePrefab.ActivationSettings);
            _sourcePrefab.ActivationSettings.WorldRotation = _transform.rotation;
        }
Beispiel #2
0
 public void BeginMouseMoveAlongDirectionSession(Vector3 moveDirection)
 {
     if (!IsAnyMouseSessionActive)
     {
         _mouseMoveAlongDirectionSession.Begin(gameObject, moveDirection, ObjectPlacementGuideSettings.Get().MouseOffsetFromPlacementSurfaceSettings);
     }
 }
Beispiel #3
0
        public void RotateUsingKeyboardSettings(Vector3 customRotationAxis)
        {
            if (IsAnyMouseSessionActive)
            {
                return;
            }
            UndoEx.RecordForToolAction(_transform);

            ObjectKeyboardRotationSettings keyboardRotationSettings = ObjectPlacementGuideSettings.Get().KeyboardRotationSettings;

            gameObject.RotateHierarchyBoxAroundPoint(keyboardRotationSettings.CustomAxisRotationSettings.RotationAmountInDegrees,
                                                     customRotationAxis, gameObject.GetHierarchyWorldOrientedBox().Center);

            UndoEx.RecordForToolAction(_sourcePrefab.ActivationSettings);
            _sourcePrefab.ActivationSettings.WorldRotation = _transform.rotation;
        }