Search Unity

Can Cinemachine be used as gameplay camera?

Discussion in 'Cinemachine' started by Le_Tai, Apr 7, 2018.

  1. Le_Tai

    Le_Tai

    Joined:
    Jun 20, 2014
    Posts:
    442
    Everything I see online about Cinemachine seems to be all about cinematic, but I don't see a reason why it can't be used as gameplay camera. Is this one of the expected use case? Is there any reason I should avoid doing this?
     
  2. mountblanc

    mountblanc

    Joined:
    Sep 24, 2015
    Posts:
    93
    There are some demo video's of Unity themselves where they talk about in game usage where cut scenes are triggered.
    It involves a mouse. Also the track features are used to track a player for example moving true the terrain and switching camera's for best angles.

    There is also a new blog about changing Cinemachine stuff from script. https://blogs.unity3d.com/2018/04/05/creative-scripting-for-timeline/
    I myself am using Cinemachine in my upcoming 2d game to switch from train cart to train cart and to the lift letting the scene machine camera follow different objects and move between them. I love the more natural movement of the camera keeping the object on screen but not in the exact middle all the time. If you add Cinemachine to your project there are some demo scenes that show game play setups.
     
    Gregoryl likes this.
  3. Adam_Myhill

    Adam_Myhill

    Joined:
    Dec 22, 2016
    Posts:
    342
    We hear this question all the time. Yes, CM is an in-game camera system. There's so many features in CM just for games. We are guilty of this perception as many of the demos show just cinematic stuff but there's so much in there for gameplay specifically.

    I'm not sure what genre your game is but one way to see a bunch of gameplay specific features is to checkout our demo scenes.

    After CM is loaded, install the demo scenes:
    upload_2018-4-7_11-31-57.png

    It will load a bunch of example scenes which cover all sorts of genres and gameplay cameras:
    upload_2018-4-7_11-33-27.png

    They're super basic scenes but a fun way to see how to configure CM in a bunch of different ways.

    Here's a talk where I go over some more gameplay camera ideas.


    If you have questions after that, don't hesitate to hit us up here on the forums.
     
    ezed1, ve110cet, bitinn and 4 others like this.
  4. ve110cet

    ve110cet

    Joined:
    Dec 11, 2017
    Posts:
    10
    Any tutorials for the gameplay stuff? Especially switching up the camera based on state changes?
     
  5. Adam_Myhill

    Adam_Myhill

    Joined:
    Dec 22, 2016
    Posts:
    342
    Hi @ve110cet - two things to get you started:

    There's this:


    Also, there's the example scenes which have a demo of this in action. Go Cinemachine->Install demo scenes from the top menu bar and checkout the State Driven Camera scene
     
  6. fuzzyScrub

    fuzzyScrub

    Joined:
    Apr 5, 2018
    Posts:
    1
    Any tips regarding simple object orbiting camera done by Cinemachine? With traditional script approach, this is simple, however, I was wondering if there is some solutions build in the tool or another type of approaches more fitting for the Cinemachine.

    Looking for something like this: https://lmhpoly.com/unity-tutorial-rotate-a-camera-around-the-object/
     
  7. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,724
    Do exactly the same thing that you would do with a script, except that instead of animating the Camera directly, animate a vcam with DoNothing in Aim and Body, so that it won't perform any procedural positioning on its own.
     
    adnanzmn97 likes this.
  8. 11rolf

    11rolf

    Joined:
    Aug 8, 2017
    Posts:
    5
    I am looking for a tutorial how to use Cinemachine in a multiplay game following the right player. Any advice how to do that?
     
  9. Radiago

    Radiago

    Joined:
    Jan 7, 2014
    Posts:
    18
    If it's split screen, what you end up doing is having separate cameras for each player, with separate brains on each camera, and then each brain camera needs to be on a different layer. Then that brain only solves for virtual cameras on the same layer. Simply have a new layer for each player possibly, and assign the follow/look at targets for the virtual cameras to their respective player objects.
     
  10. K0ST4S

    K0ST4S

    Joined:
    Feb 2, 2017
    Posts:
    35
    Is cinemachine heavy on CPU? Would it be worth writing my own script if I only wanted to have a blend between two cameras?