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.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Bug Recenter Wait Time inconsistent on FreeLook

Discussion in 'Cinemachine' started by KHam256, Sep 1, 2022.

  1. KHam256

    KHam256

    Joined:
    Sep 17, 2016
    Posts:
    19
    I am on Unity 2021.3.8f1 with Cinemachine 2.8.9

    I am using a custom Input provider and am successfully passing input through GetAxisValue(). I would expect that Recentering would stop and begin again after Wait Time has elapsed but that is not what is happening. However, when I set Wait Time to something high, Recentering is delayed for some inconsistent amount of time (e.g. 3 second delay when Wait Time is set to 10). This delay to recenter varies from play to play.

    Here is my FreeLook setup
    upload_2022-9-1_12-10-0.png

    And here is my custom input provider
    Code (CSharp):
    1. public class CinemachineCameraInput : MonoBehaviour, AxisState.IInputAxisProvider
    2. {
    3.     private float _xAxis;
    4.     private float _yAxis;
    5.  
    6.     public float GetAxisValue(int axis)
    7.     {
    8.         switch (axis)
    9.         {
    10.             case 0: return _xAxis;
    11.             case 1: return _yAxis;
    12.             default: return 0;
    13.         }
    14.     }
    15.  
    16.     public void Rotate(Vector2 input)
    17.     {
    18.         _xAxis = input.x;
    19.         _yAxis = input.y;
    20.     }
    21. }
     
    HugoCoin likes this.
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,267
    Recentering waits the specified amount of time when I try it. Can you make a test project that demonstrates this problem?
     
  3. KHam256

    KHam256

    Joined:
    Sep 17, 2016
    Posts:
    19
    @Gregoryl I'll DM you the project.

    Theres 2 issues it will demonstrate.

    1. The Recentering starts immediately when wait time is set to 4 or less.
    2. With everything set to FixedUpdate (Brian, character controller, etc) camera movement on the Y axis is very jittery compared to movement on the X axis. The lower the framerate the more choppy the movement so I've set framerate to 30 for the project.

    I can get the Y axis movement to work smoothly when set to LateUpdate but the project benefits the most from the CharacterController operating in FixedUpdate.
     
    HugoCoin likes this.
  4. iph0

    iph0

    Joined:
    Nov 15, 2017
    Posts:
    4
    I have the same problem with Cinemachine 2.8.9 (Unity 2021.3.14). It seems that actual Wait Time becomes on five seconds shorter than specified. For ecample, if I specify 7 secons it will wait 2 seconds. So if I specify 3, it becomes 0.

    After some time of debugging I installed Cinemachine 2.9.4 and it doesn't have this problem. Wait Time works as it should. But I have some concerns about this version because it not verified yet for Unity 2021.3
     
  5. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,267
    Don't worry about the verification, it's fine. Everyone should use 2.9.4 instead of 2.8.X.
     
  6. iph0

    iph0

    Joined:
    Nov 15, 2017
    Posts:
    4
    Ah, great. Then I will do so. Thank you)