API reference
API reference
Select your platform
No SDKs available
No versions available

HandGrabAPI Class

Extends MonoBehaviour
The HandGrabAPI class provides functionality to detect finger grabs using multiple IFingerAPI implementations.
It distinguishes between pinch and palm grabs and allows customization of the grab detectors through dependency injection, using the InjectOptionalFingerPinchAPI and InjectOptionalFingerGrabAPI methods.

Properties

Gets the IHand implementation associated with this instance.
This property is crucial for accessing hand-specific data required for grab detection.
IHmd Hmd[Get]

Protected Functions

virtual void Awake ( )
virtual void Start ( )

Member Functions

Returns the flags indicating which fingers are currently performing a pinch grab.
Returns
A HandFingerFlags value representing the fingers involved in pinch grabs.
Returns the flags indicating which fingers are currently performing a palm grab.
Returns
A HandFingerFlags value representing the fingers involved in palm grabs.
Determines if the hand is currently performing a pinch grab according to the specified rules.
Parameters
fingers
The GrabbingRule defining required and optional fingers for the grab.
Returns
True if the hand meets the pinch grab conditions; otherwise, false.
Determines if the hand is currently performing a palm grab according to the specified rules.
Parameters
fingers
The GrabbingRule defining required and optional fingers for the grab.
Returns
True if the hand meets the palm grab conditions; otherwise, false.
Determines if the grab condition is sustained based on the specified grabbing rules and current grabbing fingers.
Parameters
fingers
The GrabbingRule specifying required and optional fingers.
grabbingFingers
The current state of fingers that are grabbing.
Returns
True if the grab condition is sustained; otherwise, false.
Determine whether the state of any of the finger pinches have changed this frame to the target pinching state (on/off).
Parameters
fingers
Finger GrabbingRule to check.
Returns
True if any finger's pinch state has changed according to the rules; otherwise, false.
Determines whether the state of any of the finger grabs have changed this frame to the target grabbing state (on/off).
Parameters
fingers
Finger GrabbingRule to check.
Returns
True if any finger's grab state has changed according to the rules; otherwise, false.
Determines whether the state of any of the finger pinches have changed this frame to the target pinching state (on/off).
Parameters
fingers
Finger GrabbingRule to check.
Returns
True if any finger's pinch state has changed according to the rules; otherwise, false.
Determines whether the state of any of the finger grabs have changed this frame to the target grabbing state (on/off).
Parameters
fingers
Finger GrabbingRule to check.
Returns
True if any finger's grab state has changed according to the rules; otherwise, false.
Calculates the center position of the pinch grab based on the wrist offset.
Returns
The world position of the pinch center.
Calculates the center position of the palm grab based on the wrist offset.
Returns
The world position of the palm center.
Retrieves the overall score of how well the hand is performing a pinch grab based on specified rules.
Parameters
fingers
The rules defining required and optional fingers for the pinch grab.
includePinching
Indicates whether to include currently pinching fingers in the score calculation.
Returns
A float representing the pinch grab score, where higher values indicate a stronger grab.
Retrieves the overall score of how well the hand is performing a palm grab based on specified rules.
Parameters
fingers
The GrabbingRule defining required and optional fingers for the palm grab.
includeGrabbing
Indicates whether to include currently grabbing fingers in the score calculation.
Returns
A float representing the palm grab score, where higher values indicate a stronger grab.
Retrieves the strength of the pinch grab for a specific finger.
Parameters
finger
The HandFinger to check the pinch strength for.
Returns
A float representing the pinch strength, where higher values indicate a stronger pinch.
Retrieves the percentage of completion for a pinch gesture for a specific finger.
Parameters
finger
The HandFinger to check the pinch percentage for.
Returns
A float representing the percentage of the pinch completion.
Retrieves the distance between the thumb and the specified finger during a pinch gesture.
Parameters
finger
The HandFinger to measure the distance from the thumb.
Returns
A float representing the distance between the thumb and the specified finger during a pinch.
Retrieves the strength of the palm grab for a specific finger.
Parameters
finger
The HandFinger to check the palm grab strength for.
Returns
A float representing the palm grab strength, where higher values indicate a stronger grab.
void SetPinchGrabParam
( PinchGrabParam paramId,
float paramVal )
float GetPinchGrabParam
( PinchGrabParam paramId )
Checks if a specific finger is currently grabbing.
Parameters
finger
The finger to check for grabbing status.
Returns
True if the specified finger is grabbing; otherwise, false.
bool GetFingerIsPalmGrabbing
( HandFinger finger )
Injects custom IHand implementations for the HandGrabAPI.
This method facilitates unit testing.
Parameters
hand
The custom IHand implementation to inject.
void InjectHand
( IHand hand )
void InjectOptionalHmd
( IHmd hmd )
Injects an optional custom implementation for the pinch grab API.
Parameters
fingerPinchAPI
The custom pinch grab IFingerAPI to inject.
Injects an optional custom implementation for the palm grab API.
Parameters
fingerGrabAPI
The custom palm grab IFingerAPI to inject.
Did you find this page helpful?
Thumbs up icon
Thumbs down icon