Search Unity

Question Reset the third person follow virtual camera in Starter Assets.

Discussion in 'Cinemachine' started by viknesh2020, Jan 10, 2023.

  1. viknesh2020

    viknesh2020

    Joined:
    Jul 19, 2016
    Posts:
    52
    Hey everyone ! I wanted to reset the camera view of the Cinemachine Virtual Camera. Basically, I am using the Starter Assets Third Person Controller, which has a third person follow virtual camera. The Body is set to '3rd person follow' and the aim is set to 'Do Nothing'. I have gone through various threads on resetting the camera view and tried the below but nothing is resetting the camera to its initial position or rotation.

    Code (CSharp):
    1. vCam.PreviousStateIsValid = false;
    Code (CSharp):
    1. vCam.ForceCameraPosition(Vector3 pos, Quaternion rot);
    Code (CSharp):
    1. vCam.enabled = false;
    2. vCam.transform.position = vCamInitPos;
    3. vCam.transform.rotation = vCamInitRot;
    4. vCam.enabled = true;
    Code (CSharp):
    1. vCam.transform.SetPositionAndRotation(vCamInitPos, vCamInitRot);
    My Virtual camera settings and CineMachineBrain are given below

    Screenshot 2023-01-03 at 3.38.32 PM.png

    Screenshot 2023-01-03 at 3.38.49 PM.png

    The initial view at the start of the game:

    Screenshot 2023-01-03 at 3.39.26 PM.png

    After few moments, the current view:

    Screenshot 2023-01-03 at 3.39.41 PM.png

    After calling Reset(), the view I want:

    Screenshot 2023-01-03 at 3.39.26 PM.png

    I hope the screenshots explains the issue better. Any help would be appreciated.
     
  2. gaborkb

    gaborkb

    Unity Technologies

    Joined:
    Nov 7, 2019
    Posts:
    856
    ThirdPersonFollow is a rig that determines the camera position based on the Follow Target. It also sets the rotation of the camera to the rotation of the Follow target.

    There are several ways to modify the rotation:
    1. You can reset the Follow target's rotation (in your case PlayerCameraRoot's rotation).

    2. You can add an Aim behaviour and a LookAt target. The value calculated by this Aim behaviour will overwrite the value set by ThirdPersonFollow.

    3. You can write a CinemachineExtension that modifies the rotation of the camera. For an example, see Cinemachine3rdPersonAim.
     
    Gregoryl likes this.
  3. ugbanaka1

    ugbanaka1

    Joined:
    Mar 22, 2023
    Posts:
    1
    Hello am trying to click on the reset third person controller amateur in my unity but I can't find it what do I do please
     
  4. Paul_Hughes

    Paul_Hughes

    Joined:
    Sep 6, 2018
    Posts:
    33
    I'm exactly the same.
    Crazy there is no simple way to do this i.e. update the camera when the player has respawned to the start etc.
    When I respawn the player has the correct position and rotation, but the camera has not updated to the correct rotation, surely there should be a much simpler way to update the position of the camera?

    I have seen the post above from a Unity Dev, so reset the follow? Set it to null and back to the playerCameraRoot?

    Thanks.