Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Question Strange Camera Movement

Discussion in 'Cinemachine' started by hsklunity, Mar 24, 2023.

  1. hsklunity

    hsklunity

    Joined:
    Jun 9, 2022
    Posts:
    5
    Hi,

    I have my game divided into different parts/scenes which are loaded when needed. I am using the freelook cinemachine camera. After I hit a play button in my game menu, the player and map are loaded additionally. The freelook target and look at is then set to the player using a script.
    When the freelook is placed in a different scene than the player the camera makes strange movements as if it was placed somewhere else and now moves and rotates towards the player. Camera GameObject as well as the freelook GameObject are placed exactly at the same place where the player is (in inspector before starting the game).
    But if I place the freelook GameObject in the same scene as the Player (as a sibling not as a child), there is no such movement and the camera is immediately at the supposed position.

    Has anyone faced the same issues or knows how to resolve it other than having the freelook camera in the same scene as the player?
     
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    6,859
    In your script that assigns the player as FreeLook target, be sure also to set freeLook.PreviousStateIsValid = false. That will cancel the freeLook's memory of where it was, and so it won't lerp to the new position.
     
    hsklunity likes this.
  3. hsklunity

    hsklunity

    Joined:
    Jun 9, 2022
    Posts:
    5
    Ah yes, apparently that was the issue. Thank you very much!
     
    Gregoryl likes this.