Search Unity

Question Recreating Moving Out Camera system

Discussion in 'Cinemachine' started by Gamrek, Sep 25, 2020.

  1. Gamrek

    Gamrek

    Joined:
    Sep 28, 2010
    Posts:
    164
    I am trying to recreating the game Moving Out Camera system, where it support multiplayer. Camera will always have all the players in the camera. I think this is using Target Group, but it seems I can get everyone in the camera with some distances on each edge of the screen.

    Also, if I have some jumping platform and below it is lava which kill player if missing jumping. The camera will also move down with it. How can I avoid camera moving down to min. height?

    Sorry, I am very new to Cinemachine. Thanks in advance.
     
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,719
    It's all about target groups. Add each player to the target group, with a weight of 1. You can control the framing (how far from the screen edge the players are) by using the settings inside the vcam (Framing Size in Group Composer or Framing Transposer, whichever one you're using).

    For the lava, you'll have to write a custom script that lerps the weight of the falling player from 1 to 0, so that the camera loses interest in it and stops following it. You can try setting the group weight of that player suddenly to 0 but probably you'll get a camera pop as it reframes. That's why you need to lerp over a short time.
     
    gaborkb likes this.
  3. Gamrek

    Gamrek

    Joined:
    Sep 28, 2010
    Posts:
    164

    thanks, I assume I would use ontriggerenter to trigger the event and get the camera group settings? Is there a global variable, or I have to reference it from the script?
     
  4. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,719
    I don't quite understand your question.

    Set up a CinemachineTargetGreoup (it's a component on a GameObject), and create a manager script to add/remove your players to/from it. Your virtual Camera should use that group as a LookAt/Follow target.
     
  5. Gamrek

    Gamrek

    Joined:
    Sep 28, 2010
    Posts:
    164
    Sorry, what I mean was is there a CameraGroup.Main or CameraGroup.Current or something along this line that I can use.
     
  6. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,719
    no, you create and manage them yourself