Class MicrogestureSwipeControl
Represents the thumb swipe microgesture as a normalized 2D direction, with each direction also available as a button.
Inherited Members
Namespace: UnityEngine.XR.Hands
Assembly: Unity.XR.Hands.dll
Syntax
[Preserve]
[InputControlLayout(displayName = "Microgesture Swipe")]
public class MicrogestureSwipeControl : Vector2Control
Remarks
When the runtime recognizes a thumb swipe, the matching direction button becomes pressed. The value is the normalized sum of the pressed directions' vectors: left for swipeLeft, right for swipeRight, up for swipeForward, and down for swipeBackward. When no direction button is pressed, the value is zero.
To respond to each swipe, use the performed callback or WasPerformedThisFrame() on an action bound to this control, rather than polling the value.
Constructors
MicrogestureSwipeControl()
Creates a new thumb swipe microgesture control.
Declaration
public MicrogestureSwipeControl()
Remarks
The Input System creates this control from the device layout. You don't need to call this constructor.
See Also
Properties
swipeBackward
The button that's pressed when the runtime recognizes a thumb swipe backward.
Declaration
[InputControl(offset = 0, bit = 3, displayName = "Swipe Backward")]
public ButtonControl swipeBackward { get; set; }
Property Value
| Type | Description |
|---|---|
| ButtonControl |
See Also
swipeForward
The button that's pressed when the runtime recognizes a thumb swipe forward.
Declaration
[InputControl(offset = 0, bit = 2, displayName = "Swipe Forward")]
public ButtonControl swipeForward { get; set; }
Property Value
| Type | Description |
|---|---|
| ButtonControl |
See Also
swipeLeft
The button that's pressed when the runtime recognizes a thumb swipe to the left.
Declaration
[InputControl(name = "x", layout = "MicrogestureSwipeAxis", offset = 0, bit = 0, sizeInBits = 4, format = "BIT", synthetic = true)]
[InputControl(name = "y", layout = "MicrogestureSwipeAxis", offset = 0, bit = 0, sizeInBits = 4, format = "BIT", synthetic = true)]
[InputControl(offset = 0, bit = 0, displayName = "Swipe Left")]
public ButtonControl swipeLeft { get; set; }
Property Value
| Type | Description |
|---|---|
| ButtonControl |
See Also
swipeRight
The button that's pressed when the runtime recognizes a thumb swipe to the right.
Declaration
[InputControl(offset = 0, bit = 1, displayName = "Swipe Right")]
public ButtonControl swipeRight { get; set; }
Property Value
| Type | Description |
|---|---|
| ButtonControl |
See Also
Methods
FinishSetup()
Completes initialization after the control hierarchy is in place.
Declaration
protected override void FinishSetup()
Overrides
See Also
ReadUnprocessedValueFromState(void*)
Reads the value of the control from the given state, without applying processors.
Declaration
public override Vector2 ReadUnprocessedValueFromState(void* statePtr)
Parameters
| Type | Name | Description |
|---|---|---|
| void* | statePtr | State containing the control's state block. |
Returns
| Type | Description |
|---|---|
| Vector2 | The swipe direction, or zero if no swipe is active. |
Overrides
See Also
WriteValueIntoState(Vector2, void*)
Writes the given swipe direction into the given state by setting the matching direction button.
Declaration
public override void WriteValueIntoState(Vector2 value, void* statePtr)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector2 | value | The swipe direction to write, such as left, or zero for no swipe. |
| void* | statePtr | State containing the control's state block. |