Esempio n. 1
0
        protected override void InputUpdate()
        {
            base.InputUpdate();

            gimbalController.Rotate(new Vector2(horizontalRotationInputAxis.FloatValue() * gimbalRotationSpeed * Time.deltaTime,
                                                -verticalRotationInputAxis.FloatValue() * gimbalRotationSpeed * Time.deltaTime));
        }
Esempio n. 2
0
 public void SetRotationInputs(float xAxisInput, float yAxisInput, float zAxisInput)
 {
     if (gimbalController != null)
     {
         gimbalController.Rotate(new Vector2(yAxisInput * rotationSensitivityY, xAxisInput * rotationSensitivityX));
     }
 }
Esempio n. 3
0
        protected override void InputUpdate()
        {
            if (vehicleCamera != null)
            {
                if (cycleViewForwardInput.Down())
                {
                    vehicleCamera.CycleCameraView(true);
                    if (cameraGimbal != null)
                    {
                        cameraGimbal.ResetGimbal();
                    }
                }
                else if (cycleViewBackwardInput.Down())
                {
                    vehicleCamera.CycleCameraView(false);
                    if (cameraGimbal != null)
                    {
                        cameraGimbal.ResetGimbal();
                    }
                }
            }

            if (vehicleCamera.HasCameraViewTarget && vehicleCamera.SelectedCameraViewTarget.CameraView == VehicleCameraView.Interior)
            {
                if (cameraGimbal != null)
                {
                    if (enableLookAroundInput.Pressed())
                    {
                        // Look around
                        cameraGimbal.Rotate(new Vector2(cameraGimbalRotationSpeed * horizontalRotationAxisInput.FloatValue(),
                                                        cameraGimbalRotationSpeed * -verticalRotationAxisInput.FloatValue()));
                    }

                    if (enableLookAroundInput.Up())
                    {
                        cameraGimbal.ResetGimbal();
                    }
                }
            }
        }
Esempio n. 4
0
        protected override void InputUpdate()
        {
            // Cycle camera view
            if (cameraEntity != null)
            {
                if (cycleViewForwardInput.Down())
                {
                    cameraEntity.CycleCameraView(true);
                }
                else if (cycleViewBackwardInput.Down())
                {
                    cameraEntity.CycleCameraView(false);
                }
            }

            // Select camera view
            for (int i = 0; i < cameraViewInputs.Count; ++i)
            {
                if (cameraViewInputs[i].input.Down())
                {
                    cameraEntity.SetView(cameraViewInputs[i].view);
                }
            }

            // Free look mode
            if (cameraGimbalController != null)
            {
                if (freeLookModeInput.Pressed())
                {
                    cameraGimbalController.Rotate(lookHorizontalInput.FloatValue() * freeLookSpeed,
                                                  -lookVerticalInput.FloatValue() * freeLookSpeed);
                }
                else if (freeLookModeInput.Up())
                {
                    cameraGimbalController.ResetGimbal(true);
                }
            }
        }
Esempio n. 5
0
        // Physics update
        protected virtual void FixedUpdate()
        {
            // Implement independent rotation
            if (independentRotationEnabled)
            {
                ImplementIndependentGimbalRotation();
            }

            if (rotationInputEnabled)
            {
                // Rotate the gimbal
                gimbalController.Rotate(horizontalRotationInput * Time.fixedDeltaTime * rotationSpeed, verticalRotationInput * Time.fixedDeltaTime * rotationSpeed);
            }

            // Call the event
            onGimbalControllerUpdated.Invoke();

            // Update the independent rotation value
            if (independentRotationEnabled)
            {
                UpdateIndependentGimbalRotation();
            }
        }