Search Unity

Question Freelook simple Follow with World Up default value

Discussion in 'Cinemachine' started by jeromeisabelle, Apr 26, 2023.

  1. jeromeisabelle

    jeromeisabelle

    Joined:
    Aug 29, 2018
    Posts:
    21
    Hi,

    I'm using a freelook camera with simple follow with world up and I would like the camera to be placed behind the character by default at the start. How can I do that? Right now, the camera is placed at a seemingly random angle at the start.

    Thank you!
     
  2. jeromeisabelle

    jeromeisabelle

    Joined:
    Aug 29, 2018
    Posts:
    21
  3. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,730
    SimpleFollowWithWorldUp will move the camera to be within a certain distance of the target - it does not specify a viewing angle, but starts with the virtual camera's actual position. If you want it to start somewhere specific, you can use vcam.ForceCameraPosition() to place it.
     
    Last edited: Apr 28, 2023
    jeromeisabelle likes this.
  4. jeromeisabelle

    jeromeisabelle

    Joined:
    Aug 29, 2018
    Posts:
    21
    Sorry, but I'm not sure I understand what you mean by "starts with the virtual camera's actual position"? If you mean the FreeLook camera transform, then mine is all 0 by default and then I set the follow and lookAt target at runtime to the player and then the values become all weird.
     
  5. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,730
    In that case FreeLook will take the shortest path from its current location to a new location that satisfies the follow distance. At the same time as you set the targets, you can also call freeLook.ForceCameraPosition to put it close to where you want it to be.
     
    jeromeisabelle likes this.