Search Unity

  1. Improved Prefab workflow (includes Nested Prefabs!), 2D isometric Tilemap and more! Get the 2018.3 Beta now.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  4. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

Cinemachine - How to add Zoom control to Freelook camera

Discussion in 'Cinemachine' started by muniraj_143, Nov 21, 2017.

  1. MSachs

    MSachs

    Joined:
    Nov 22, 2017
    Posts:
    86
    Oh that actually wasn't my intention at all. Then again I didn't write that code myself :rolleyes:
    How exactly do I change the axis names via script? Just tried a few things but it doesn't seem to work like that...
     
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    1,532
    something like:
    var freeLook = GetComponent<CinemachineFreeLook>();
    freeLook.m_XAxis.m_InputAxisName = "blabla";
    etc
     
  3. MSachs

    MSachs

    Joined:
    Nov 22, 2017
    Posts:
    86
    Okay great, thank you. It works... kind of. For some reason now the Decel Time doesn't get triggered when releasing the button... so the camera just spins around the target forever.
     
  4. MSachs

    MSachs

    Joined:
    Nov 22, 2017
    Posts:
    86
    Just kind of fixed it by adding a WaitForSeconds to delay the reset of the axis a split second. don't know if thats the best way though.

    Edit: It appears to happen, when the Mouse is moving the second the input gets turned of. Then it kind of saves the mouse movement and continues to spin around as long as the input isn't turned on again. Is there a command to force the deceleration to happen?
     
    Last edited: Sep 14, 2018
  5. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    1,532
    Right. You also need to set the m_xAxis.m_InputAxisValue to zero, or it simply freezes with the last value seen.
     
    MSachs likes this.
  6. MSachs

    MSachs

    Joined:
    Nov 22, 2017
    Posts:
    86
    Great! Thanks a lot!