Class XRFingerShapeMath
Extension methods for XRHand to calculate the XRFingerShape for each finger. Also provides static access to the Finger State Processor that is used to clear the cache of calculated values.
Inherited Members
Namespace: UnityEngine.XR.Hands.Gestures
Assembly: Unity.XR.Hands.dll
Syntax
public static class XRFingerShapeMath
Methods
CalculateFingerShape(XRHand, XRHandFingerID, XRFingerShapeTypes)
Calculate values useful for pose detection for a single finger. Will
only calculate fields of XRFingerShape for
corresponding flags that are set in shapeTypes
.
Declaration
public static XRFingerShape CalculateFingerShape(this XRHand xrHand, XRHandFingerID fingerID, XRFingerShapeTypes shapeTypes)
Parameters
Type | Name | Description |
---|---|---|
XRHand | xrHand | The XRHand from which to get finger joint data. |
XRHandFingerID | fingerID | Denotes which finger to calculate XRFingerState values for. |
XRFingerShapeTypes | shapeTypes | Denotes which fields to calculate in the returned XRFingerShape. |
Returns
Type | Description |
---|---|
XRFingerShape | Returns an XRFingerShape with values calculated if
their corresponding flags were set in |
Remarks
Calling this overload will use a XRFingerShapeConfiguration with the current configuration. The configuration is set to a sensible default provided by the platform.
CalculateFingerShape(XRHand, XRHandFingerID, XRFingerShapeTypes, XRFingerShapeConfiguration)
Calculate values useful for pose detection for a single finger. Will
only calculate fields of XRFingerShape for
corresponding flags that are set in shapeTypes
.
Declaration
public static XRFingerShape CalculateFingerShape(this XRHand xrHand, XRHandFingerID fingerID, XRFingerShapeTypes shapeTypes, XRFingerShapeConfiguration configuration)
Parameters
Type | Name | Description |
---|---|---|
XRHand | xrHand | The XRHand from which to get finger joint data. |
XRHandFingerID | fingerID | Denotes which finger to calculate XRFingerShape values for. |
XRFingerShapeTypes | shapeTypes | Denotes which fields to calculate in the returned XRFingerShape. |
XRFingerShapeConfiguration | configuration | The configuration used to convert joint data to finger state values. |
Returns
Type | Description |
---|---|
XRFingerShape | Returns an XRFingerShape with values calculated if
their corresponding flags were set in |
ResetFingerShapeConfiguration(XRHandFingerID)
Resets the finger state configuration to default for all future calls to XRFingerStateMathUtilities.CalculateFingerStates for the given finger.
Declaration
public static void ResetFingerShapeConfiguration(XRHandFingerID fingerID)
Parameters
Type | Name | Description |
---|---|---|
XRHandFingerID | fingerID | Which finger to reset the XRFingerShapeConfiguration for. |
Remarks
If you wish to override the default, call SetFingerShapeConfiguration(XRHandFingerID, XRFingerShapeConfiguration).
SetFingerShapeConfiguration(XRHandFingerID, XRFingerShapeConfiguration)
Set the finger state configuration to use for all future calls to XRFingerStateMathUtilities.CalculateFingerStates for the given finger.
Declaration
public static void SetFingerShapeConfiguration(XRHandFingerID fingerID, XRFingerShapeConfiguration configuration)
Parameters
Type | Name | Description |
---|---|---|
XRHandFingerID | fingerID | Which finger to set the XRFingerShapeConfiguration for. |
XRFingerShapeConfiguration | configuration | The configurations for the given finger. If null, that finger's configuration will revert to an appropriate default. |
Remarks
If you wish to restore the default, call ResetFingerShapeConfiguration(XRHandFingerID).
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown if |