Search Unity

  1. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  2. Want more efficiency in your development work? Sign up to receive weekly tech and creative know-how from Unity experts.
    Dismiss Notice
  3. Participate with students all over the world and build projects to teach people. Join now!
    Dismiss Notice
  4. Build games and experiences that can load instantly and without install. Explore the Project Tiny Preview today!
    Dismiss Notice
  5. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  6. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

Cinemachine back to main camera help!

Discussion in 'Cinemachine' started by fiendishdraws, Nov 29, 2018.

  1. fiendishdraws

    fiendishdraws

    Joined:
    Oct 1, 2017
    Posts:
    6
    Hi! Sorry to bother you all but I have a question concerning cinemachine and timeline. I have a main camera, the camera within my FirstPersonCharacter but wanted to create a simple cutscene with cinemachine. I made a timeline and then added a cinemachine brain to different camera objects within the same scene. Each Camera object have a virtual camera in place. I added all the brains to the timeline. Is it possible for cinemachine to end there and return to my main camera viewport? It seems no matter what I do, it simply stays in the perspective of one virtual camera.

    Sincerely,

    Ed
     
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    1,823
    You've not set this up quite correctly.

    You should have a single Unity Camera, with a single Brain on it.

    Then, you create multiple VirtualCamera objects. Say you have one for the main gameplay, and a number of others referenced from the timeline. The CM timeline tracks are all bound to the single Brain, with individual clips on the tracks bound to the vcams.

    Now, when you run the timeline, the vcams referenced from it will drive the main camera. When the timeline stops, control will be returned to the gameplay vcam.

    So remember the paradigm: one Camera, one Brain, many vcams.
     
  3. fiendishdraws

    fiendishdraws

    Joined:
    Oct 1, 2017
    Posts:
    6
    Ok thanks but my main camera doesn't use a virtual camera. Is it possible to simply return back to my FPS controller's camera? Or do I have to attach a virtual camera to my FPS controller. I have effects on my camera on it already so it would be a hassle.
     
    Last edited: Nov 29, 2018
  4. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    1,823
    What you can do in this case is to replace the FPS controller's Camera component with a CinemachineVirtualCamera component with a higher-than-default priority. That will become the main gameplay camera.

    So in summary:
    1. Have a top-level gameobject with Camera and CinemachineBrain. This is your scene's one and only camera.
    2. Replace the Camera component in the FPS controller with a CinemachineVirtualCamera component. Put "Do Nothing" in both Aim and Body. This turns off the procedural features and allows your vcam to be 100% driven by its trransform, which is controlled by your FPS script. Make this the default vcam by giving it higher priority. Now you have the equivalent of your original FPS system, but with the possibility to blend this camera with other vcams, add noise, impulse, etc.
    3. Create timelines with other vcams to use in cutscene. For performance, you can disable those other vcam gameObjects, they will be force-enabled when invoked from the timeline.
     
  5. fiendishdraws

    fiendishdraws

    Joined:
    Oct 1, 2017
    Posts:
    6
    Thanks so much! It works but unfortunately the AQUAS and Enviro camera script don't.
     
  6. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    1,823
    I'm not familiar with those scripts. If they are depending on a Camera component, you might try either or both of:
    • hacking them to use a vcam component instead
    • just disable the Camera component instead of deleting it
     
  7. fiendishdraws

    fiendishdraws

    Joined:
    Oct 1, 2017
    Posts:
    6
    I can fix it apparently by putting them on the main camera. However, I have kept camera disabled in my FPS controller but it seems when I delete it, it breaks everything and the timeline no longer follows my other vcams and then the FPS vcam. It's strange. Also, when I keep the camera disabled on my FPS controller with the vcam, I cant look up or down.
     
  8. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    1,823
    I can't really tell you what's wrong without seeing the project.

    Another possible approach for you is to keep 2 cameras: one with the FPS and another one, with the brain, for cutscenes only. When the timeline begins, disable the FPS camera and enable the CM camera. When the timeline ends, do the opposite. You won't get blending between them, but maybe that's ok for you.
     
  9. fiendishdraws

    fiendishdraws

    Joined:
    Oct 1, 2017
    Posts:
    6
    Tried, still can't look up or down. It's weird.
     
  10. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    1,823
    I've seen the up and down thing before - some thread on this forum, in the last month or so, just can't find it. It's the way the controller is built. There is an easy fix, I just don't remember what offhand. Try putting the controller back to what it was before these experiments.