API reference

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

Hand : IHand
[Get]
Gets the IHand implementation associated with this instance.
This property is crucial for accessing hand-specific data required for grab detection.
Signature
IHand Oculus.Interaction.GrabAPI.HandGrabAPI.Hand
Hmd : IHmd
[Get]
Signature
IHmd Oculus.Interaction.GrabAPI.HandGrabAPI.Hmd

Protected Methods

Awake ()
Signature
virtual void Oculus.Interaction.GrabAPI.HandGrabAPI.Awake()
Returns
void
Start ()
Signature
virtual void Oculus.Interaction.GrabAPI.HandGrabAPI.Start()
Returns
void

Methods

GetFingerIsGrabbing ( finger )
Checks if a specific finger is currently grabbing.
Signature
bool Oculus.Interaction.GrabAPI.HandGrabAPI.GetFingerIsGrabbing(HandFinger finger)
Parameters
finger: HandFinger  The finger to check for grabbing status.
Returns
bool  True if the specified finger is grabbing; otherwise, false.
GetFingerIsPalmGrabbing ( finger )
Signature
bool Oculus.Interaction.GrabAPI.HandGrabAPI.GetFingerIsPalmGrabbing(HandFinger finger)
Parameters
finger: HandFinger
Returns
bool
GetFingerPalmStrength ( finger )
Retrieves the strength of the palm grab for a specific finger.
Signature
float Oculus.Interaction.GrabAPI.HandGrabAPI.GetFingerPalmStrength(HandFinger finger)
Parameters
finger: HandFinger  The HandFinger to check the palm grab strength for.
Returns
float  A float representing the palm grab strength, where higher values indicate a stronger grab.
GetFingerPinchDistance ( finger )
Retrieves the distance between the thumb and the specified finger during a pinch gesture.
Signature
float Oculus.Interaction.GrabAPI.HandGrabAPI.GetFingerPinchDistance(HandFinger finger)
Parameters
finger: HandFinger  The HandFinger to measure the distance from the thumb.
Returns
float  A float representing the distance between the thumb and the specified finger during a pinch.
GetFingerPinchPercent ( finger )
Retrieves the percentage of completion for a pinch gesture for a specific finger.
Signature
float Oculus.Interaction.GrabAPI.HandGrabAPI.GetFingerPinchPercent(HandFinger finger)
Parameters
finger: HandFinger  The HandFinger to check the pinch percentage for.
Returns
float  A float representing the percentage of the pinch completion.
GetFingerPinchStrength ( finger )
Retrieves the strength of the pinch grab for a specific finger.
Signature
float Oculus.Interaction.GrabAPI.HandGrabAPI.GetFingerPinchStrength(HandFinger finger)
Parameters
finger: HandFinger  The HandFinger to check the pinch strength for.
Returns
float  A float representing the pinch strength, where higher values indicate a stronger pinch.
GetHandPalmScore ( fingers , includeGrabbing )
Retrieves the overall score of how well the hand is performing a palm grab based on specified rules.
Signature
float Oculus.Interaction.GrabAPI.HandGrabAPI.GetHandPalmScore(in GrabbingRule fingers, bool includeGrabbing=true)
Parameters
fingers: in GrabbingRule  The GrabbingRule defining required and optional fingers for the palm grab.
includeGrabbing: bool  Indicates whether to include currently grabbing fingers in the score calculation.
Returns
float  A float representing the palm grab score, where higher values indicate a stronger grab.
GetHandPinchScore ( fingers , includePinching )
Retrieves the overall score of how well the hand is performing a pinch grab based on specified rules.
Signature
float Oculus.Interaction.GrabAPI.HandGrabAPI.GetHandPinchScore(in GrabbingRule fingers, bool includePinching=true)
Parameters
fingers: in GrabbingRule  The rules defining required and optional fingers for the pinch grab.
includePinching: bool  Indicates whether to include currently pinching fingers in the score calculation.
Returns
float  A float representing the pinch grab score, where higher values indicate a stronger grab.
GetPalmCenter ()
Calculates the center position of the palm grab based on the wrist offset.
Signature
Vector3 Oculus.Interaction.GrabAPI.HandGrabAPI.GetPalmCenter()
Returns
Vector3  The world position of the palm center.
GetPinchCenter ()
Calculates the center position of the pinch grab based on the wrist offset.
Signature
Vector3 Oculus.Interaction.GrabAPI.HandGrabAPI.GetPinchCenter()
Returns
Vector3  The world position of the pinch center.
GetPinchGrabParam ( paramId )
Signature
float Oculus.Interaction.GrabAPI.HandGrabAPI.GetPinchGrabParam(PinchGrabParam paramId)
Parameters
paramId: PinchGrabParam
Returns
float
HandPalmGrabbingFingers ()
Returns the flags indicating which fingers are currently performing a palm grab.
Signature
HandFingerFlags Oculus.Interaction.GrabAPI.HandGrabAPI.HandPalmGrabbingFingers()
Returns
HandFingerFlags  A HandFingerFlags value representing the fingers involved in palm grabs.
HandPinchGrabbingFingers ()
Returns the flags indicating which fingers are currently performing a pinch grab.
Signature
HandFingerFlags Oculus.Interaction.GrabAPI.HandGrabAPI.HandPinchGrabbingFingers()
Returns
HandFingerFlags  A HandFingerFlags value representing the fingers involved in pinch grabs.
InjectAllHandGrabAPI ( hand )
Injects custom IHand implementations for the HandGrabAPI.
This method facilitates unit testing.
Signature
void Oculus.Interaction.GrabAPI.HandGrabAPI.InjectAllHandGrabAPI(IHand hand)
Parameters
hand: IHand  The custom IHand implementation to inject.
Returns
void
InjectHand ( hand )
Signature
void Oculus.Interaction.GrabAPI.HandGrabAPI.InjectHand(IHand hand)
Parameters
hand: IHand
Returns
void
InjectOptionalFingerGrabAPI ( fingerGrabAPI )
Injects an optional custom implementation for the palm grab API.
Signature
void Oculus.Interaction.GrabAPI.HandGrabAPI.InjectOptionalFingerGrabAPI(IFingerAPI fingerGrabAPI)
Parameters
fingerGrabAPI: IFingerAPI  The custom palm grab IFingerAPI to inject.
Returns
void
InjectOptionalFingerPinchAPI ( fingerPinchAPI )
Injects an optional custom implementation for the pinch grab API.
Signature
void Oculus.Interaction.GrabAPI.HandGrabAPI.InjectOptionalFingerPinchAPI(IFingerAPI fingerPinchAPI)
Parameters
fingerPinchAPI: IFingerAPI  The custom pinch grab IFingerAPI to inject.
Returns
void
InjectOptionalHmd ( hmd )
Signature
void Oculus.Interaction.GrabAPI.HandGrabAPI.InjectOptionalHmd(IHmd hmd)
Parameters
hmd: IHmd
Returns
void
IsHandPalmGrabbing ( fingers )
Determines if the hand is currently performing a palm grab according to the specified rules.
Signature
bool Oculus.Interaction.GrabAPI.HandGrabAPI.IsHandPalmGrabbing(in GrabbingRule fingers)
Parameters
fingers: in GrabbingRule  The GrabbingRule defining required and optional fingers for the grab.
Returns
bool  True if the hand meets the palm grab conditions; otherwise, false.
IsHandPinchGrabbing ( fingers )
Determines if the hand is currently performing a pinch grab according to the specified rules.
Signature
bool Oculus.Interaction.GrabAPI.HandGrabAPI.IsHandPinchGrabbing(in GrabbingRule fingers)
Parameters
fingers: in GrabbingRule  The GrabbingRule defining required and optional fingers for the grab.
Returns
bool  True if the hand meets the pinch grab conditions; otherwise, false.
IsHandSelectPalmFingersChanged ( fingers )
Determines whether the state of any of the finger grabs have changed this frame to the target grabbing state (on/off).
Signature
bool Oculus.Interaction.GrabAPI.HandGrabAPI.IsHandSelectPalmFingersChanged(in GrabbingRule fingers)
Parameters
fingers: in GrabbingRule  Finger GrabbingRule to check.
Returns
bool  True if any finger's grab state has changed according to the rules; otherwise, false.
IsHandSelectPinchFingersChanged ( fingers )
Determine whether the state of any of the finger pinches have changed this frame to the target pinching state (on/off).
Signature
bool Oculus.Interaction.GrabAPI.HandGrabAPI.IsHandSelectPinchFingersChanged(in GrabbingRule fingers)
Parameters
fingers: in GrabbingRule  Finger GrabbingRule to check.
Returns
bool  True if any finger's pinch state has changed according to the rules; otherwise, false.
IsHandUnselectPalmFingersChanged ( fingers )
Determines whether the state of any of the finger grabs have changed this frame to the target grabbing state (on/off).
Signature
bool Oculus.Interaction.GrabAPI.HandGrabAPI.IsHandUnselectPalmFingersChanged(in GrabbingRule fingers)
Parameters
fingers: in GrabbingRule  Finger GrabbingRule to check.
Returns
bool  True if any finger's grab state has changed according to the rules; otherwise, false.
IsHandUnselectPinchFingersChanged ( fingers )
Determines whether the state of any of the finger pinches have changed this frame to the target pinching state (on/off).
Signature
bool Oculus.Interaction.GrabAPI.HandGrabAPI.IsHandUnselectPinchFingersChanged(in GrabbingRule fingers)
Parameters
fingers: in GrabbingRule  Finger GrabbingRule to check.
Returns
bool  True if any finger's pinch state has changed according to the rules; otherwise, false.
IsSustainingGrab ( fingers , grabbingFingers )
Determines if the grab condition is sustained based on the specified grabbing rules and current grabbing fingers.
Signature
bool Oculus.Interaction.GrabAPI.HandGrabAPI.IsSustainingGrab(in GrabbingRule fingers, HandFingerFlags grabbingFingers)
Parameters
fingers: in GrabbingRule  The GrabbingRule specifying required and optional fingers.
grabbingFingers: HandFingerFlags  The current state of fingers that are grabbing.
Returns
bool  True if the grab condition is sustained; otherwise, false.
SetPinchGrabParam ( paramId , paramVal )
Signature
void Oculus.Interaction.GrabAPI.HandGrabAPI.SetPinchGrabParam(PinchGrabParam paramId, float paramVal)
Parameters
paramId: PinchGrabParam
paramVal: float
Returns
void