Hello,
my goal: the player should be able to switch between a FreeLook- and a FPS- and a TPS camera.
My setup: all 3 cameras are CinemachineCameras and work as intended. The player object has tracking-targets. A cameramanager-script implements the camerachanges.
Problem 1: Moving the FreeLookCam rotates the FPS-cam, too. I found a solution by disabling the InputAxisControllerComponent of the FPS-cam. Maybe there is a better way to do this.
Problem 2: Turning the player in TPS-mode turns the FPS-cam only half the way with FPS-InputAxisController enabled. The TPS-cam has no InputAxisControllerComponent.
Rotating the FPS-cam by scripting was not successful.
Maybe the screens are helpfull to understand the problem…
Startingpoint - FreeLookCam active:
Changing to FPS-cam, rotating Player-Object in +x-direction:
Switch to TPS-cam, turning Player-Object back - roundabout 45 Degrees:
Back to FPS-Cam, the rotation should be the same as those of the Player Object…
Relevant code:
Debug.Log("CameraManager - ChangeCam - fpscamrotation: " + fpsCam.transform.localEulerAngles);
Debug.Log("CameraManager - ChangeCam - playerrotation: " + player.transform.localEulerAngles);
fpsCam.transform.rotation = player.transform.rotation;
Debug.Log("CameraManager - ChangeCam - playerrotation end: " + player.transform.localEulerAngles);
Debug.Log("CameraManager - ChangeCam - fpscamrotation end: " + fpsCam.transform.localEulerAngles);
Thanks