Search Unity

Camera stuck after cutscene ends

Discussion in 'Cinemachine' started by Tapiiri, Apr 17, 2019.

  1. Tapiiri

    Tapiiri

    Joined:
    Mar 22, 2019
    Posts:
    13
    I have a pretty simple cutscene of a character laying on a bed and getting up. I have a main camera which follows the character from behind and two virtuals for different angles for the cutscene. Problem is that when the cutscene ends, the camera is stuck looking at the bed instead of going back to behind the character. How should I proceed?
     
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,728
    Your main camera is for when the cutscene isn't playing, right? So it's the current active vcam when the cutscene starts, and it remains the current active vcam when the cutscene ends. Is that correct?

    So, now you start the timeline with the cutscene vcams. They override the current active vcams for as long as the CM clips in the timeline last. When those clips end, the control is reverted back to the current active vcam, which should be still your main camera, unless you have changed it.

    What are you doing that's different?
     
  3. Tapiiri

    Tapiiri

    Joined:
    Mar 22, 2019
    Posts:
    13
    Yes, that's correct.

    The main camera does activate after the cutscene ends, but it's no longer where it's supposed to be (behind the character) but instead it's at the same position as vcam1 (pointed at the bed).
     
  4. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,728
    That shouldn't be. The main vcam should be correctly placed when timeline ends.
    What versions of Unity and CM are you using?
    Can you show me the inspector of the main vcam?
     
  5. Tapiiri

    Tapiiri

    Joined:
    Mar 22, 2019
    Posts:
    13
    Unity 2018.3.11f1, Cinemachine is 2.1.10 I think, I downloaded it from the asset store.
     

    Attached Files:

  6. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,728
    You need to upgrade Cinemachine.
    1. Start by making a full backup of your project.
    2. Open an empty scene
    3. Delete the Cinemachine folder from your assets
    4. Open Windows/Package Manager, and find Cinemachine in the list
    5. Install it from there. Version should be 2.2.8
    6. Now you should be able to open your real scene and have the new version of CM
    7. You may need to re-install the CM/PostProcessing adapter package, if you have it
    Please try that and let me know if the problem gets cleared up.
     
  7. Tapiiri

    Tapiiri

    Joined:
    Mar 22, 2019
    Posts:
    13
    I updated Cinemachine but the problem still exists.
     
  8. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,728
    Can you show me the inspector for the main virtual camera that's giving you the problem?
     
  9. Tapiiri

    Tapiiri

    Joined:
    Mar 22, 2019
    Posts:
    13
    The virtual cameras are working fine. I have two virtual cameras and they show the angles they are supposed to. The problem is the main camera, which is the same camera you get when opening a new scene. Before working on the cutscene I had it set up so that it follows the player from behind. Now when the cut scene ends, the main camera shows the same angle as vcam1 (the bed) when it should still follow the player.
     
  10. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,728
    aahhh! now I understand the problem.

    Create a new virtual camera, which you will use as your main follow cam. Don't use the main camera directly.
    In your follow script, move the new vcam instead of the main camera. If the new vcam has a higher priority than any other vcam in the scene (or if it's the only active one), then the main camera with the CM brain will track the vcam exactly.

    Make sure that the new vcam has DoNothing in both Aim and Body, to turn off all procedural logic and allow the vcam's transform to be driven by your follow script.

    The main camera (with the CM brain) should be in an unparented game object, all by itself. It's the Brain's job to track the current active vcam and move the camera to the right place every frame.
     
  11. Tapiiri

    Tapiiri

    Joined:
    Mar 22, 2019
    Posts:
    13
    Many thanks, that fixed the camera issue! Now, however (and before the camera fix as well), my character doesn't respond to movement commands after the cutscene, would you know why that could be?
     
  12. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,728
    Is it possible that your cutscene is taking control of the character's position and not letting it go?
     
  13. Tapiiri

    Tapiiri

    Joined:
    Mar 22, 2019
    Posts:
    13
    It seems the problem was that I had to check "Apply root motion" from the Animator tab. Again, many thanks for your help!
     
    Gregoryl likes this.