Search Unity

Advanced Tutorial for Cinemachine

Discussion in 'Cinemachine' started by VP_no1, May 29, 2018.

  1. VP_no1

    VP_no1

    Joined:
    May 12, 2018
    Posts:
    132
    Hi,

    First of all I can tell you that I do not have Cinematics experience and some of the terminology is new to me. This means that I cannot understand very fast what this and that is doing. Most of all I understand them through examples because the theory in written always uses words that the brain cannot comprehend without application. I got a lot of notions but the small derivations from main tutorials it is what is important.
    I watched all the demos and many of the tutorials.
    I played for days with many settings in FreeLook Camera.
    My setup is this one:
    1. main camera seeing all the map
    2. game camera start that has the BRAIN component
    3. StateDrivenFreelok object and cameras from your demo

    The main problem is this: watching tutorial like this
    is too light to be able to understand the complexity of the axis, rigs, orbits.
    Also I do not know if Cine Brain is where it should be or not. I put it there (see above) because i use Adventure Creator and I had to have a game camera to declare to AC. I tested some other scenarios and it doesnt seem to work in another way.

    What I would like to achieve its a camera similar to Assasins Creed main one. So this main camera would be in the back and a bit on top of my character with an angle so I can see a bit of the world in front of my character (3rd person) and the camera would move smoothly on X axis when i rotate it with mouse but not on other axis. This should happen on the zoomed in follow camera (which I know how to do by your grace). On zooming out I should have it on like 70degrees in char back so i see it on his right side but still abit in the back - the camera would move smoothly left-right just to rotate slightly in the back of character if I want to but becasue I might check some objects in the screen view I would like the camera not to move if I am away with cursor further tan X from my character (maybe it cant do both but maybe a 3rd camera should follow). If you think is better make a fixed camera for zooming out then how do I blend and configure their transition ? I need a state to figure the scrolling wheel so when I use zoom in out to a certain level it changes the cameras ? And how do I reffer to the zoomed position ?

    I hope I didn't give you a headache :)
     
  2. VP_no1

    VP_no1

    Joined:
    May 12, 2018
    Posts:
    132
  3. syscrusher

    syscrusher

    Joined:
    Jul 4, 2015
    Posts:
    1,104
    I have done something similar to this using the State Driven Camera. My setup has a First Person rig, a Third Person over-the-shoulder rig, and a Free Look rig for screen shots. The player can toggle among these by pressing the V key on the keyboard or a button on the gamepad. There is a nice video tutorial on State Driven Cameras.

    What you do is have a State Driven Camera at the top of the hierarchy and then put your follow camera, orbit camera, and so forth as child objects below the SDC.

    Two things not mentioned in the tutorial that you should know:
    1. Make sure you have the most recent Cinemachine update in your project. There was a fairly annoying bug impacting the FreeLook camera, causing a lot of jitter, and that bug was fixed a couple of weeks ago. :)
    2. It is possible to nest State Driven Cameras inside each other, to create a very complex multi-state rig. I don't think you will need to do this, but it is a useful fact to keep in mind.
    If you need to have cameras in your scene that are *not* controlled by Cinemachine, or you need more than one CM Brain on a real camera (such as if you're doing a minimap overlay), you put the different camera environments on different layers and set their culling masks appropriately. More details in this forum or in this tutorial.

    It can (and usually does) take some fiddling to get Cinemachine to do exactly what you want, so back up your project and do some exploring of options. It's an extremely powerful tool!
     
    Last edited: May 31, 2018
    mandisaw likes this.
  4. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,728
    Actually cutscenes don't require another brain. If you're using timeline for the cutscene, then the CM tracks there will take over the Game Camera's brain while they're active, and release it again afterwards as if nothing ever happened.
     
    syscrusher likes this.
  5. syscrusher

    syscrusher

    Joined:
    Jul 4, 2015
    Posts:
    1,104
    You're right in the general case. Sorry, I was conflating a more complex split-screen thing I'm working on here that uses the layering technique you taught in the other thread. :)

    EDIT: I corrected my post above so as not to give out bad info to future readers of this thread. @Gregoryl thanks for the correction, and please let me know if I've still got it wrong.
     
    Last edited: May 31, 2018
    Gregoryl likes this.
  6. VP_no1

    VP_no1

    Joined:
    May 12, 2018
    Posts:
    132
    I am trying to get through all you said, thank you!
     
  7. VP_no1

    VP_no1

    Joined:
    May 12, 2018
    Posts:
    132
    Hello again
    I have AC, Invector and Cinemachine and they work together and are integrated correctly.
    I want my view to be controlled by Cinemachine only.
    What should be the correct hierarchy of the cameras (SDC or others) so that Cinemachine controlls what its rendering ?
    Where I should put the brain ?
    AC with Cinemachine I know what to do but there is another component involved: a third person camera from Invector that demands a Main camera Tag.
    Also what layers should I choose for each ?
    I studied all of the assets but the combination of them it is failing on many occasions. The only configuration that worked was to have a simple game camera as Brain and have the invector's camera as main camera with the CM cameras stackked on it. It seems to me a bad configuration but others didnt work.
    (I disabled the script of Invector's camera)
     
  8. VP_no1

    VP_no1

    Joined:
    May 12, 2018
    Posts:
    132
    I attach some pictures for the configuration it is working:

    1. Hierarchy (the grey ones are disabled)
    upload_2018-6-3_12-24-48.png

    2. the top SDC
    upload_2018-6-3_12-28-20.png

    3. this is the simple follow

    upload_2018-6-3_12-33-21.png

    4. this is the invector's camera

    upload_2018-6-3_12-33-57.png

    ps. I noticed that the simple follow CAM is working all the time and the Freelook and Frellok Sprint are not tirggered. I would like a camera to move in the back of player when he is turning to 90 degrees or more so I always have the view in front. I thought SDC would help best but how do I trigger them in such cases ?
     
    syscrusher likes this.
  9. VP_no1

    VP_no1

    Joined:
    May 12, 2018
    Posts:
    132
    I think I got it on the state changing thing but I have some questions:

    I must put a higher priority on the Free Look Cameras so they override the general locomotion state ? (see pic bellow) or must I do something else ?
    How can I see when cameras are changing like a text over screen ? Because they move very fast on screen and becasue I dont know how to have the camera always in my back, I cannot tell.

    upload_2018-6-3_12-56-19.png
     
  10. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,728
    I'm not familiar with AC so can't give you any advice there. Maybe someone else can help with that?

    You don't need a higher priority on the SimpleFollow. It will become active in the default Locomotion State.

    If you check "Show Debug Text" in the SDC inspector it will show you what's going n on the game view, including current blend state. There is a similar checkbox on the Brain. Check them both.
     
    Last edited: Jan 30, 2020
  11. VP_no1

    VP_no1

    Joined:
    May 12, 2018
    Posts:
    132
    Last edited: Jun 4, 2018
  12. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,728
    Sorry, I meant to say Invector. I'm not familiar with either of them.
     
  13. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,728
    Invector looks like it wants a Camera to control. I'm just guessing here but maybe you can fool it by making a dummy game object with a disabled Camera component, and give it that as the camera to move around. If you then add a CinmachineVirtualCamera component to that dummy camera, with Do Nothing in both Body and Aim, then the CinemachinBrain will see it as a virtual camera and allow it to control the real camera when it is activated.
     
  14. syscrusher

    syscrusher

    Joined:
    Jul 4, 2015
    Posts:
    1,104
    I don't use AC or Invector, but @Gregoryl I can vouch that your reasoning is sound. I did something similar to this with ExplCamera in a test scene so a free-flying camera could be part of a Timeline-driven CM sequence. (It's complicated why I wanted to do this, and not relevant to this thread's topic.) Things worked for me as your post predicts. YMMV.
     
  15. VP_no1

    VP_no1

    Joined:
    May 12, 2018
    Posts:
    132
    I will try do what you told me thank you.
    I will get back to you asap :)
     
  16. DeidreReay

    DeidreReay

    Joined:
    Oct 28, 2019
    Posts:
    50
    Did anyone ever find a solution to this?? I am thinking of using Gregoryl has said, but before diving in was hoping that someone might have found this solution already. Thanks
     
  17. Gr33nIguana

    Gr33nIguana

    Joined:
    Feb 24, 2011
    Posts:
    14
    I use Invector 2.5.5 and cinemachine, in Unity 2019.4.18, and the described setup works directly for me. Camera can be used in cut-scenes and can be controlled by Invector. The only thing that does not seem to work are the camera state settings. I see in the Invector camera script that the camera state does change, only the FOV value from the camera state does not get passed on to the virtual camera (FOV stays the same). I tried adding a new virtual camera variable to the Invector camera script and pass on the state.fov, it works but it does not go so smoothly like the normal Invector setup. Any idea's to make the virtual camera lerp the fov the same as the camera states?