Search Unity

Modifying Orbit Rig values at Runtime

Discussion in 'Cinemachine' started by Tyrant99, Apr 30, 2019.

  1. Tyrant99

    Tyrant99

    Joined:
    Dec 6, 2018
    Posts:
    4
    Hi, I have what I think is a pretty simple question:

    How do I modify these values on the freelook camera with code?

    upload_2019-4-30_5-51-3.png

    I got as far as (pseudo-code):

    using Cinemachine;
    public GameObject MyVCam;

    void ChangeOrbits()
    {
    CinemachineFreeLook VCamControl = MyVCam.GetComponent<CinemachineFreeLook>();
    VCamControl.m_Orbits.
    }

    But it seems to return generic array functions. I'd like to be able to access any one of those particular height or radius floats on the top, middle, and bottom rig.

    I tried looking around for examples and in the API, but wasn't having much luck.

    I'm pretty new to Cinemachine, any chance that I could get a quickie code snippet example to set one of those floats? - That should get me on my way.

    Thanks.
     

    Attached Files:

  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,730
    Code (CSharp):
    1. VCamControl.m_Orbits[1].m_Radius = 3;
     
    cloud02468 and Tyrant99 like this.
  3. Tyrant99

    Tyrant99

    Joined:
    Dec 6, 2018
    Posts:
    4
    Oh, perfect, just need the array index.

    I'm a dummy, haha, thanks.