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.
Inherited Members
Namespace: UnityEngine.XR.Interaction.Toolkit.AR
Syntax
public abstract class GestureRecognizer<T>
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
[Obsolete("m_Gestures has been deprecated. Use gestures instead. (UnityUpgradable) -> gestures")]
protected List<T> m_Gestures
Field Value
Type | Description |
---|---|
List<T> |
Remarks
m_Gestures
has been deprecated. Use gestures instead.
Properties
arSessionOrigin
The ARSessionOrigin that will be used by gestures (such as to get the Camera or to transform from Session space).
Declaration
[Obsolete("arSessionOrigin has been deprecated. Use xrOrigin instead for similar functionality.")]
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
xrOrigin
The XROrigin that will be used by gestures (such as to get the Camera or to transform from Session space).
Declaration
public XROrigin xrOrigin { get; set; }
Property Value
Type | Description |
---|---|
XROrigin |
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<Touch, T>)
(Deprecated) Helper function for creating one-finger gestures when a touch begins.
Declaration
[Obsolete("TryCreateOneFingerGestureOnTouchBegan(Func<InputSystem.EnhancedTouch.Touch, T>) is no longer functional. Use TryCreateOneFingerGestureOnTouchBegan(Func<InputSystem.EnhancedTouch.Touch, T>, Action<T, InputSystem.EnhancedTouch.Touch>) instead.", true)]
protected void TryCreateOneFingerGestureOnTouchBegan(Func<Touch, T> createGestureFunction)
Parameters
Type | Name | Description |
---|---|---|
Func<Touch, T> | createGestureFunction | Function to be executed to create the gesture. |
Remarks
TryCreateOneFingerGestureOnTouchBegan(Func<InputSystem.EnhancedTouch.Touch, T>)
has been deprecated. Use
TryCreateOneFingerGestureOnTouchBegan(Func<Touch, T>, Action<T, Touch>) instead.
TryCreateOneFingerGestureOnTouchBegan(Func<Touch, T>, Action<T, Touch>)
Helper function for creating or reinitializing one-finger gestures when a touch begins.
Declaration
protected void TryCreateOneFingerGestureOnTouchBegan(Func<Touch, T> createGestureFunction, Action<T, Touch> reinitializeGestureFunction)
Parameters
Type | Name | Description |
---|---|---|
Func<Touch, T> | createGestureFunction | Function to be executed to create the gesture if no dead gesture was available to re-initialize. |
Action<T, Touch> | reinitializeGestureFunction | Function to be executed to re-initialize the gesture if a dead gesture was available to re-initialize. |
TryCreateOneFingerGestureOnTouchBegan(Func<Touch, T>)
(Deprecated) Helper function for creating one-finger gestures when a touch begins.
Declaration
[Obsolete("TryCreateOneFingerGestureOnTouchBegan(Func<Touch, T>) is no longer functional. Use TryCreateOneFingerGestureOnTouchBegan(Func<Touch, T>, Action<T, Touch>) instead.", true)]
protected void TryCreateOneFingerGestureOnTouchBegan(Func<Touch, T> createGestureFunction)
Parameters
Type | Name | Description |
---|---|---|
Func<Touch, T> | createGestureFunction | Function to be executed to create the gesture. |
Remarks
TryCreateOneFingerGestureOnTouchBegan(Func<Touch, T>)
has been deprecated. Use
TryCreateOneFingerGestureOnTouchBegan(Func<Touch, T>, Action<T, Touch>) instead.
TryCreateOneFingerGestureOnTouchBegan(Func<Touch, T>, Action<T, Touch>)
Helper function for creating or re-initializing one-finger gestures when a touch begins.
Declaration
protected void TryCreateOneFingerGestureOnTouchBegan(Func<Touch, T> createGestureFunction, Action<T, Touch> reinitializeGestureFunction)
Parameters
Type | Name | Description |
---|---|---|
Func<Touch, T> | createGestureFunction | Function to be executed to create the gesture if no dead gesture was available to re-initialize. |
Action<T, Touch> | reinitializeGestureFunction | Function to be executed to re-initialize the gesture if a dead gesture was available to re-initialize. |
TryCreateTwoFingerGestureOnTouchBegan(Func<Touch, Touch, T>)
(Deprecated) Helper function for creating two-finger gestures when a touch begins.
Declaration
[Obsolete("TryCreateTwoFingerGestureOnTouchBegan(Func<InputSystem.EnhancedTouch.Touch, InputSystem.EnhancedTouch.Touch, T>) is no longer functional. Use TryCreateTwoFingerGestureOnTouchBegan(Func<InputSystem.EnhancedTouch.Touch, InputSystem.EnhancedTouch.Touch, T>, Action<T, InputSystem.EnhancedTouch.Touch, InputSystem.EnhancedTouch.Touch>) instead.", true)]
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. |
Remarks
TryCreateTwoFingerGestureOnTouchBegan(Func<Touch, Touch, T>)
has been deprecated. Use
TryCreateTwoFingerGestureOnTouchBegan(Func<Touch, Touch, T>, Action<T, Touch, Touch>) instead.
TryCreateTwoFingerGestureOnTouchBegan(Func<Touch, Touch, T>, Action<T, Touch, Touch>)
Helper function for creating two-finger gestures when a touch begins.
Declaration
protected void TryCreateTwoFingerGestureOnTouchBegan(Func<Touch, Touch, T> createGestureFunction, Action<T, Touch, Touch> reinitializeGestureFunction)
Parameters
Type | Name | Description |
---|---|---|
Func<Touch, Touch, T> | createGestureFunction | Function to be executed to create the gesture if no dead gesture was available to re-initialize. |
Action<T, Touch, Touch> | reinitializeGestureFunction | Function to be executed to re-initialize the gesture if a dead gesture was available to re-initialize. |
TryCreateTwoFingerGestureOnTouchBegan(Func<Touch, Touch, T>)
(Deprecated) Helper function for creating two-finger gestures when a touch begins.
Declaration
[Obsolete("TryCreateTwoFingerGestureOnTouchBegan(Func<Touch, Touch, T>) is no longer functional. Use TryCreateTwoFingerGestureOnTouchBegan(Func<Touch, Touch, T>, Action<T, Touch, Touch>) instead.", true)]
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. |
Remarks
TryCreateTwoFingerGestureOnTouchBegan(Func<Touch, Touch, T>)
has been deprecated. Use
TryCreateTwoFingerGestureOnTouchBegan(Func<Touch, Touch, T>, Action<T, Touch, Touch>) instead.
TryCreateTwoFingerGestureOnTouchBegan(Func<Touch, Touch, T>, Action<T, Touch, Touch>)
Helper function for creating or re-initializing two-finger gestures when a touch begins.
Declaration
protected void TryCreateTwoFingerGestureOnTouchBegan(Func<Touch, Touch, T> createGestureFunction, Action<T, Touch, Touch> reinitializeGestureFunction)
Parameters
Type | Name | Description |
---|---|---|
Func<Touch, Touch, T> | createGestureFunction | Function to be executed to create the gesture if no dead gesture was available to re-initialize. |
Action<T, Touch, Touch> | reinitializeGestureFunction | Function to be executed to re-initialize the gesture if a dead gesture was available to re-initialize. |
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> |