Пример #1
0
        private void ProcessManualPanning(ShipCamTargetValues targets)
        {
            if (Input.GetMouseButton(MouseButtonIndex))
            {
                if (!ManualPanMode)
                {
                    //set these before they will be affected buy setting the _manualTimeRemaining up.
                    _manualParentPollTarget = GetParentPollTarget(targets);
                    _manualPanTimeRemaining = ManualTime;
                    _manualUpTarget         = targets.UpTarget;
                }
                var vertical   = Input.GetAxis("Mouse Y");
                var horizontal = Input.GetAxis("Mouse X");
                //Debug.Log("vertical: " + vertical);
                //Debug.Log("horizontal: " + horizontal);

                _manualParentPollTarget = Quaternion.AngleAxis(-RotationSpeed * vertical, _shipCam.Camera.transform.right) * transform.forward;
                _manualParentPollTarget = Quaternion.AngleAxis(RotationSpeed * horizontal, _shipCam.Camera.transform.up) * _manualParentPollTarget;

                _manualUpTarget = Quaternion.AngleAxis(-RotationSpeed * vertical, _shipCam.Camera.transform.right) * transform.up;
                _manualUpTarget = Quaternion.AngleAxis(RotationSpeed * horizontal, _shipCam.Camera.transform.up) * _manualUpTarget;
                //Debug.Log(_pollTarget);
                return;
            }
            _manualPanTimeRemaining -= Time.unscaledDeltaTime;
        }
Пример #2
0
        private Vector3 GetCameraLocationTarget(ShipCamTargetValues automaticTargets)
        {
            var setbackDistance = ManualZoomMode ? _manualCameraLocOffset : 0;
            var offset          = automaticTargets.CameraPollTarget * setbackDistance;

            return(automaticTargets.CameraLocationTarget + offset);
        }
Пример #3
0
        public ShipCamTargetValues AddTo(ShipCamTargetValues b, float thisWeighting = 1, float bWeighting = 1)
        {
            var parentLocationTarget = this.ParentLocationTarget * thisWeighting + b.ParentLocationTarget * bWeighting;
            var parentPollTarget     = this.ParentPollTarget * thisWeighting + b.ParentPollTarget * bWeighting;

            var cameraLocationTarget = this.CameraLocationTarget * thisWeighting + b.CameraLocationTarget * bWeighting;
            var cameraPollTarget     = this.CameraPollTarget * thisWeighting + b.CameraPollTarget * bWeighting;

            var upTarget = this.UpTarget * thisWeighting + b.UpTarget * bWeighting;

            var cameraFieldOfView = this.CameraFieldOfView * thisWeighting + b.CameraFieldOfView * bWeighting;

            var referenceVelocity = this.ReferenceVelocity * thisWeighting + b.ReferenceVelocity * bWeighting;

            return(new ShipCamTargetValues(parentLocationTarget, parentPollTarget, cameraLocationTarget, cameraPollTarget, cameraFieldOfView, referenceVelocity, upTarget));
        }
Пример #4
0
 private Vector3 GetUpTarget(ShipCamTargetValues automaticTargets)
 {
     return(ManualPanMode ? _manualUpTarget : automaticTargets.UpTarget);
 }
Пример #5
0
 private Vector3 GetParentPollTarget(ShipCamTargetValues automaticTargets)
 {
     return(ManualPanMode ? _manualParentPollTarget : automaticTargets.ParentPollTarget);
 }