Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Question How to make camera follow a path ?

Discussion in 'Cinemachine' started by Naxo175, Mar 12, 2023.

  1. Naxo175

    Naxo175

    Joined:
    Jan 9, 2021
    Posts:
    10
    Hi, I want that my camera follows a custom path but also follows my player's X position. So if my player goes right, the camera will follow the path that is at the same position as the player, and if he goes left, the camera will go left while following the path. I don't know if you understand me, I will try to find a game that does what I want.
     
  2. JeffG

    JeffG

    Joined:
    Oct 21, 2013
    Posts:
    85
    Have both camera's defined. If player turns right raise the priority of the follow camera, if he turns left raise the priority of the dolly tracked or path camera
     
  3. Naxo175

    Naxo175

    Joined:
    Jan 9, 2021
    Posts:
    10
    Thanks for the reply. My problem is I don't know how to make the dolly track camera go forward or backward when the player moves.
     
  4. Naxo175

    Naxo175

    Joined:
    Jan 9, 2021
    Posts:
    10
    To understand a bit better what I want, it is like the custom auto-scrolling feature in Mario Maker 2. The camera moves along the path that the level creator defined. In my game, I want the exact same thing but without auto-scroling. I want that the camera wait for the player to go forward or backward.
    Demo :
     
  5. Naxo175

    Naxo175

    Joined:
    Jan 9, 2021
    Posts:
    10
    I found the solution. I just activated Auto Dolly on the CinemachineVirtualCamera component.
    upload_2023-3-12_19-50-36.png

    Also, I don't know if I must open a new thread, but I would like to set up some waypoints where the camera zoom in or
    out on the player.
     

    Attached Files:

  6. JeffG

    JeffG

    Joined:
    Oct 21, 2013
    Posts:
    85
    Use an IsTrigger collider. OnTriggerEnter, zoom in OnTriggerExit, zoom out
     
  7. Naxo175

    Naxo175

    Joined:
    Jan 9, 2021
    Posts:
    10
    Thanks, I will try this :)