Struct AxisState
AxisState is deprecated. Use InputAxis instead.
Inherited Members
Namespace: Unity.Cinemachine
Assembly: Unity.Cinemachine.dll
Syntax
[Serializable]
[Obsolete("AxisState is deprecated. Use InputAxis instead")]
public struct AxisState
Constructors
AxisState(float, float, bool, bool, float, float, float, string, bool)
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 |
---|---|---|
float | minValue | minimum value |
float | maxValue | maximum value |
bool | wrap | whether range wraps |
bool | rangeLocked | whether range is locked |
float | maxSpeed | maximum value change speed |
float | accelTime | acceleration time |
float | decelTime | deceleration time |
string | name | input manager axis name |
bool | invert | whether axis value is inverted |
Fields
Value
The current value of the axis
Declaration
[Tooltip("The current value of the axis.")]
public float Value
Field Value
Type | Description |
---|---|
float |
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 |
---|---|
float |
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 |
---|---|
float |
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 |
---|---|
float |
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 |
---|---|
bool |
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 |
---|---|
float |
m_MaxValue
The maximum value for the axis
Declaration
[Tooltip("The maximum value for the axis")]
public float m_MaxValue
Field Value
Type | Description |
---|---|
float |
m_MinValue
The minimum value for the axis
Declaration
[Tooltip("The minimum value for the axis")]
public float m_MinValue
Field Value
Type | Description |
---|---|
float |
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 |
---|---|
bool |
Properties
HasInputProvider
Returns true if this axis has an InputAxisProvider, in which case we ignore the input axis name
Declaration
public bool HasInputProvider { get; }
Property Value
Type | Description |
---|---|
bool |
HasRecentering
True if the Recentering member is valid (bcak-compatibility support: old versions had recentering in a separate structure)
Declaration
public bool HasRecentering { readonly get; set; }
Property Value
Type | Description |
---|---|
bool |
ValueRangeLocked
Value range is locked, i.e. not adjustable by the user (used by editor)
Declaration
public bool ValueRangeLocked { readonly get; set; }
Property Value
Type | Description |
---|---|
bool |
Methods
Reset()
Cancel current input state and reset input to 0
Declaration
public void Reset()
SetInputAxisProvider(int, IInputAxisProvider)
Set an input provider for this axis. If an input provider is set, the provider will be queried when user input is needed, and the Input Axis Name field will be ignored. If no provider is set, then the legacy Input system will be queried, using the Input Axis Name.
Declaration
public void SetInputAxisProvider(int axis, AxisState.IInputAxisProvider provider)
Parameters
Type | Name | Description |
---|---|---|
int | axis | Which axis will be queried for input |
AxisState.IInputAxisProvider | provider | The input provider |
Update(float)
Updates the state of this axis based on the Input axis defined by AxisState.m_AxisName
Declaration
public bool Update(float deltaTime)
Parameters
Type | Name | Description |
---|---|---|
float | deltaTime | Delta time in seconds |
Returns
Type | Description |
---|---|
bool | Returns true if this axis's input was non-zero this Update, false otherwise |
Validate()
Call from OnValidate: Make sure the fields are sensible
Declaration
public void Validate()