Search Unity

  1. Unity 2019.1 is now released.
    Dismiss Notice

Rotating Cinemachine POV through scripts

Discussion in 'Cinemachine' started by sevensixtytwo, Oct 8, 2018.

  1. sevensixtytwo

    sevensixtytwo

    Joined:
    Apr 5, 2013
    Posts:
    1
    Hi all.

    So I'm using a Cinemachine POV component to look around with touchsticks by modifying the input value. Is there any way I can orient the camera without using the touchsticks? I'd like to implement a "Reset Vertical Look" or even make the rotation gravitate towards the current softlocked target.

    Experiments with Quaternion.RotateTowards in various configurations have failed to produce any noticable results, at least until I turn off the cinemachine scripts which also disable my input. Directly modifying the input values is pretty innacurate.

    Here's an example of my project's gameplay:
     
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    2,388
    The axis Input value generates an impulse whose result is to change the axis's Value. You can manipulate the axis.Value directly from script as well.

    The POV component's m_HorizontalAxis.Value and m_VerticalAxis.Value represent the Y and X rotations, in degrees, from world forward if vcam is not parented to anything, or parent's forward if it is.