Search Unity

CinemachineFreeLook : adjust Recentering during runtime.

Discussion in 'Cinemachine' started by canis, Oct 1, 2018.

  1. canis

    canis

    Joined:
    Oct 25, 2013
    Posts:
    67
    Hi, question about CinemachineFreeLook.cs again.
    I'm try to define 2 different recentering timing for my follow target during runtime.

    what I want to achieve is set a longer m_WaitTime & m_RecenteringTime during my character idle.
    but much faster during move.

    basically I want the full control the recenter trigger time.
    I found the public parameters in CinemachineFreeLook.cs
    { m_YAxisRecentering, m_RecenterToTargetHeading }

    Then I found the API that related to recentering :
    https://docs.unity3d.com/Packages/c....1/api/Cinemachine.AxisState.Recentering.html

    and my question are :
    1. Is there a way to detect the recentering state ? in process or reached target...etc
    2. [if above not work] how can I control the recentering manually ? DoRecentering ? each update ?
      sorry, not much information I can found on that document.
    3. May be I should start to change that values during run-time directly. (Just realize during asking question)
     
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    3,148
    You can control the recentering yourself through script. Disable the automatic recentering, and add a script to the FreeLook to bring the axis.Value back to 0 in any manner you like. You can implement this in Update() or LateUpdate(), as you prefer.
     
    canis likes this.
  3. canis

    canis

    Joined:
    Oct 25, 2013
    Posts:
    67
    Ar~ thanks, so obvious, what a silly me.