Game/Assets/Scripts/Player/Player_Control.cs
/// <summary>
/// Called to set the camera position and rotation
/// relative to player also used to set camera zoom
/// </summary>
Called to set the camera position and rotation
relative to player also used to set camera zoom
Called to set the camera position and rotation relative to player also used to set camera zoom
private void MoveCamera()
    {
        var m = Input.GetAxis("Mouse ScrollWheel");
        if (m != 0)
        {
            var cameraRef = _mainCameraTransform.GetComponent<Camera>();
            if (m > 0f)
            {
                if (_currentZoom > _MAXZOOM) return;
                cameraRef.fieldOfView -= 3;
                _currentZoom++;
            }
            else if (m < 0f)
            {
                if (_currentZoom < 0) return;
                cameraRef.fieldOfView += 3;
                _currentZoom--;
            }
        }
        _mainCameraTransform.position = transform.position;
        _mainCameraTransform.rotation = Quaternion.Euler(_cameraRotation);
        _mainCameraTransform.Translate(_cameraOffset);
        _mainCameraTransform.LookAt(transform);
    }
private void MoveCamera ( ) { var m = Input . GetAxis ( " " ) ; if ( m != 0 ) { var cameraRef = _mainCameraTransform . GetComponent < Camera > ( ) ; if ( m > 0f ) { if ( _currentZoom > _MAXZOOM ) return ; cameraRef . fieldOfView -= 3 ; _currentZoom ++ ; } else if ( m < 0f ) { if ( _currentZoom < 0 ) return ; cameraRef . fieldOfView += 3 ; _currentZoom -- ; } } _mainCameraTransform . position = transform . position ; _mainCameraTransform . rotation = Quaternion . Euler ( _cameraRotation ) ; _mainCameraTransform . Translate ( _cameraOffset ) ; _mainCameraTransform . LookAt ( transform ) ; }
Called to set the camera position and rotation
relative to player also used to set camera zoom
Called to set the camera position and rotation relative to player also used to set camera zoom
// If there is mouse wheel movement... // Zoom in // Zoom out