Class GestureRecognizer<T>
A Gesture Recognizer processes touch input to determine if a gesture should start and fires an event when the gesture is started.
Namespace: UnityEngine.XR.Interaction.Toolkit.AR
Syntax
public abstract class GestureRecognizer<T> : object where T : Gesture<T>
Type Parameters
Name | Description |
---|---|
T | The actual gesture. |
Remarks
To determine when a gesture is finished/updated, listen to events on the Gesture<T> object.
Fields
m_Gestures
(Deprecated) List of current active gestures.
Declaration
protected List<T> m_Gestures
Field Value
Type | Description |
---|---|
List<T> |
Properties
arSessionOrigin
The
Declaration
public ARSessionOrigin arSessionOrigin { get; set; }
Property Value
Type | Description |
---|---|
ARSessionOrigin |
gestures
List of current active gestures.
Declaration
protected List<T> gestures { get; }
Property Value
Type | Description |
---|---|
List<T> |
Remarks
Gestures must be added or removed using AddGesture(T) and RemoveGesture(T) rather than by directly modifying this list. This list should be treated as read-only.
See Also
Methods
AddGesture(T)
Add the given gesture
to be managed
so that it can be updated during Update().
Declaration
protected void AddGesture(T gesture)
Parameters
Type | Name | Description |
---|---|---|
T | gesture | The gesture to add. |
See Also
RemoveGesture(T)
Remove the given gesture
from being managed.
After being removed, it will no longer be updated during Update().
Declaration
protected void RemoveGesture(T gesture)
Parameters
Type | Name | Description |
---|---|---|
T | gesture | The gesture to remove. |
See Also
TryCreateGestures()
Try to recognize and create gestures.
Declaration
protected abstract void TryCreateGestures()
TryCreateOneFingerGestureOnTouchBegan(Func<InputSystem.EnhancedTouch.Touch, T>)
Helper function for creating one finger gestures when a touch begins.
Declaration
protected void TryCreateOneFingerGestureOnTouchBegan(Func<InputSystem.EnhancedTouch.Touch, T> createGestureFunction)
Parameters
Type | Name | Description |
---|---|---|
Func<InputSystem.EnhancedTouch.Touch, T> | createGestureFunction | Function to be executed to create the gesture. |
TryCreateOneFingerGestureOnTouchBegan(Func<Touch, T>)
Helper function for creating one finger gestures when a touch begins.
Declaration
protected void TryCreateOneFingerGestureOnTouchBegan(Func<Touch, T> createGestureFunction)
Parameters
Type | Name | Description |
---|---|---|
Func<Touch, T> | createGestureFunction | Function to be executed to create the gesture. |
TryCreateTwoFingerGestureOnTouchBegan(Func<InputSystem.EnhancedTouch.Touch, InputSystem.EnhancedTouch.Touch, T>)
Helper function for creating two finger gestures when a touch begins.
Declaration
protected void TryCreateTwoFingerGestureOnTouchBegan(Func<InputSystem.EnhancedTouch.Touch, InputSystem.EnhancedTouch.Touch, T> createGestureFunction)
Parameters
Type | Name | Description |
---|---|---|
Func<InputSystem.EnhancedTouch.Touch, InputSystem.EnhancedTouch.Touch, T> | createGestureFunction | Function to be executed to create the gesture. |
TryCreateTwoFingerGestureOnTouchBegan(Func<Touch, Touch, T>)
Helper function for creating two finger gestures when a touch begins.
Declaration
protected void TryCreateTwoFingerGestureOnTouchBegan(Func<Touch, Touch, T> createGestureFunction)
Parameters
Type | Name | Description |
---|---|---|
Func<Touch, Touch, T> | createGestureFunction | Function to be executed to create the gesture. |
Update()
Instantiate and update all gestures.
Declaration
public void Update()
Events
onGestureStarted
Calls the methods in its invocation list when a gesture is started. To receive an event when the gesture is finished/updated, listen to events on the Gesture<T> object.
Declaration
public event Action<T> onGestureStarted
Event Type
Type | Description |
---|---|
Action<T> |