docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Struct InputAxis

    Defines an input axis. This is a field that can take on any value in a range, with optional wrapping to form a loop.

    Inherited Members
    ValueType.Equals(object)
    ValueType.GetHashCode()
    ValueType.ToString()
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetType()
    Namespace: Unity.Cinemachine
    Assembly: solution.dll
    Syntax
    [Serializable]
    public struct InputAxis

    Fields

    Name Description
    Center

    The centered, or at-rest value of this axis.

    Range

    The valid range for the axis value. Value will be clamped to this range.

    Recentering

    Controls automatic re-centering of axis

    Restrictions

    Some usages require restricted functionality. This is set here.

    Value

    The current value of the axis. You can drive this directly from a script

    Wrap

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

    Properties

    Name Description
    DefaultMomentary

    An InputAxis set up as a normalized momentary control ranging from -1...1 with Center = 0

    Methods

    Name Description
    CancelRecentering()

    Cancel any current re-centering in progress, and reset the wait time

    ClampValue(float)

    Clamp the value to range, taking wrap into account

    GetClampedValue()

    Get the clamped axis value

    GetNormalizedValue()

    Clamp and scale the value to range 0...1, taking wrap into account

    Reset()

    Reset axis to at-rest state

    TrackValueChange()

    Call this before calling UpdateRecentering. Will track any value changes so that the re-centering clock is updated properly.

    TriggerRecentering()

    Trigger re-centering immediately, regardless of whether re-centering is enabled or the wait time has elapsed.

    UpdateRecentering(float, bool)

    Call this to manage re-centering axis value to axis center. This assumes that TrackValueChange() has been called already this frame.

    Validate()

    Make sure the settings are well-formed

    In This Article
    Back to top
    Copyright © 2023 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)