Search Unity

Resolved How to change the aim damping from script

Discussion in 'Cinemachine' started by Striker446, Sep 12, 2021.

  1. Striker446

    Striker446

    Joined:
    May 31, 2019
    Posts:
    9
    Hi , how do i change the damping value of the aim property of virtual camera from script?
     
  2. gaborkb

    gaborkb

    Unity Technologies

    Joined:
    Nov 7, 2019
    Posts:
    856
    You need to get the "Same as Follow Target" component from cinemachine, then you can access its parameters.

    For example:
    Code (CSharp):
    1. var vcam = GetComponent<CinemachineVirtualCamera>();
    2. var sameAsFollowTarget = vcam.GetCinemachineComponent<CinemachineSameAsFollowTarget>();
    3. sameAsFollowTarget.m_Damping = 1.5f;
     
  3. Striker446

    Striker446

    Joined:
    May 31, 2019
    Posts:
    9
    thanks