Struct AxisState | Cinemachine | 2.5.0
docs.unity3d.com
    Show / Hide Table of Contents

    Struct AxisState

    Axis state for defining how to react to player input. The settings here control the responsiveness of the axis to player input.

    Namespace: Cinemachine
    Syntax
    [DocumentationSorting(DocumentationSortingAttribute.Level.UserRef)]
    [Serializable]
    public struct AxisState

    Constructors

    AxisState(Single, Single, Boolean, Boolean, Single, Single, Single, String, Boolean)

    Constructor with specific values

    Declaration
    public AxisState(float minValue, float maxValue, bool wrap, bool rangeLocked, float maxSpeed, float accelTime, float decelTime, string name, bool invert)
    Parameters
    Type Name Description
    Single minValue
    Single maxValue
    Boolean wrap
    Boolean rangeLocked
    Single maxSpeed
    Single accelTime
    Single decelTime
    String name
    Boolean invert

    Fields

    m_AccelTime

    The amount of time in seconds it takes to accelerate to MaxSpeed with the supplied Axis at its maximum value

    Declaration
    [Tooltip("The amount of time in seconds it takes to accelerate to MaxSpeed with the supplied Axis at its maximum value")]
    public float m_AccelTime
    Field Value
    Type Description
    Single

    m_DecelTime

    The amount of time in seconds it takes to decelerate the axis to zero if the supplied axis is in a neutral position

    Declaration
    [Tooltip("The amount of time in seconds it takes to decelerate the axis to zero if the supplied axis is in a neutral position")]
    public float m_DecelTime
    Field Value
    Type Description
    Single

    m_InputAxisName

    The name of this axis as specified in Unity Input manager. Setting to an empty string will disable the automatic updating of this axis

    Declaration
    [FormerlySerializedAs("m_AxisName")]
    [Tooltip("The name of this axis as specified in Unity Input manager. Setting to an empty string will disable the automatic updating of this axis")]
    public string m_InputAxisName
    Field Value
    Type Description
    String

    m_InputAxisValue

    The value of the input axis. A value of 0 means no input You can drive this directly from a custom input system, or you can set the Axis Name and have the value driven by the internal Input Manager

    Declaration
    [Tooltip("The value of the input axis.  A value of 0 means no input.  You can drive this directly from a custom input system, or you can set the Axis Name and have the value driven by the internal Input Manager")]
    public float m_InputAxisValue
    Field Value
    Type Description
    Single

    m_InvertInput

    If checked, then the raw value of the input axis will be inverted before it is used.

    Declaration
    [FormerlySerializedAs("m_InvertAxis")]
    [Tooltip("If checked, then the raw value of the input axis will be inverted before it is used")]
    public bool m_InvertInput
    Field Value
    Type Description
    Boolean

    m_MaxSpeed

    How fast the axis value can travel. Increasing this number makes the behaviour more responsive to joystick input

    Declaration
    [Tooltip("The maximum speed of this axis in units/second, or the input value multiplier, depending on the Speed Mode")]
    public float m_MaxSpeed
    Field Value
    Type Description
    Single

    m_MaxValue

    The maximum value for the axis

    Declaration
    [Tooltip("The maximum value for the axis")]
    public float m_MaxValue
    Field Value
    Type Description
    Single

    m_MinValue

    The minimum value for the axis

    Declaration
    [Tooltip("The minimum value for the axis")]
    public float m_MinValue
    Field Value
    Type Description
    Single

    m_Recentering

    Automatic recentering. Valid only if HasRecentering is true

    Declaration
    [Tooltip("Automatic recentering to at-rest position")]
    public AxisState.Recentering m_Recentering
    Field Value
    Type Description
    AxisState.Recentering

    m_SpeedMode

    How to interpret the Max Speed setting.

    Declaration
    [Tooltip("How to interpret the Max Speed setting: in units/second, or as a direct input value multiplier")]
    public AxisState.SpeedMode m_SpeedMode
    Field Value
    Type Description
    AxisState.SpeedMode

    m_Wrap

    If checked, then the axis will wrap around at the min/max values, forming a loop

    Declaration
    [Tooltip("If checked, then the axis will wrap around at the min/max values, forming a loop")]
    public bool m_Wrap
    Field Value
    Type Description
    Boolean

    Value

    The current value of the axis

    Declaration
    [Tooltip("The current value of the axis.")]
    public float Value
    Field Value
    Type Description
    Single

    Properties

    HasRecentering

    True if the Recentering member is valid (bcak-compatibility support: old versions had recentering in a separate structure)

    Declaration
    public bool HasRecentering { get; set; }
    Property Value
    Type Description
    Boolean

    ValueRangeLocked

    Value range is locked, i.e. not adjustable by the user (used by editor)

    Declaration
    public bool ValueRangeLocked { get; set; }
    Property Value
    Type Description
    Boolean

    Methods

    Reset()

    Declaration
    public void Reset()

    Update(Single)

    Updates the state of this axis based on the axis defined by AxisState.m_AxisName

    Declaration
    public bool Update(float deltaTime)
    Parameters
    Type Name Description
    Single deltaTime

    Delta time in seconds

    Returns
    Type Description
    Boolean

    Returns true if this axis' input was non-zero this Update, false otherwise

    Validate()

    Call from OnValidate: Make sure the fields are sensible

    Declaration
    public void Validate()
    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023