Search Unity

Photon with cinemachine

Discussion in 'Cinemachine' started by Censureret, Aug 28, 2021.

  1. Censureret

    Censureret

    Joined:
    Jan 3, 2017
    Posts:
    363
    What is the correct way to have a cinemachine camera as the player follow camera?

    I have tried to place it in my scene but the new character that joins the scene just takes over the current camera.

    I have also tried to parent it under my player but that makes for some really odd behaviour and can do the same as the above.

    So what is the correct way to use cinemachine with multiplayer? should i instanciate a new camera every time a player join or?
     
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,724
    You should have a single Camera object in the scene, with a CinemachineBrain.
    Your character prefab should not have a camera or a vcam.
    When you instance the main player that you want the camera to follow, also instance a separate vcam (or FreeLook) object, and set its LookAt and Follow targets to the newly-instanced player.