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

HandGrabInteraction Class

This class keeps track of the grabbing anchors and updates the target and movement during a Hand Grab interaction.

Static Methods

CalculateBestGrab ( handGrabInteractor , interactable , grabFlags , activeGrabFlags , result )
Extension method for IHandGrabInteractors which calculates a new interaction target.
That is the point of the interactable at which the hand grab interaction will occur.
Signature
static void Oculus.Interaction.HandGrab.HandGrabInteraction.CalculateBestGrab(this IHandGrabInteractor handGrabInteractor, IHandGrabInteractable interactable, GrabTypeFlags grabFlags, out GrabTypeFlags activeGrabFlags, ref HandGrabResult result)
Parameters
handGrabInteractor: this IHandGrabInteractor  The interactor grabbing
interactable: IHandGrabInteractable  The interactable to be HandGrabbed
grabFlags: GrabTypeFlags  The supported GrabTypes
activeGrabFlags: out GrabTypeFlags  The anchor to use for grabbing
result: ref HandGrabResult  The a variable to store the result
Returns
void
CanInteractWith ( handGrabInteractor , handGrabInteractable )
Extension method for IHandGrabInteractor which indicates if an IHandGrabInteractor can interact with (hover and select) a given IHandGrabInteractable.
This depends on the handedness and the valid grab types of both elements.
Signature
static bool Oculus.Interaction.HandGrab.HandGrabInteraction.CanInteractWith(this IHandGrabInteractor handGrabInteractor, IHandGrabInteractable handGrabInteractable)
Parameters
handGrabInteractor: this IHandGrabInteractor  The interactor grabbing
handGrabInteractable: IHandGrabInteractable  The interactable to be grabbed
Returns
bool  True if the interactor could grab the interactable
ComputeHandGrabScore ( handGrabInteractor , handGrabInteractable , handGrabTypes , includeSelecting )
Extension method for IHandGrabInteractor which calculates the strength of the fingers of an interactor trying (or grabbing) an interactable.
"Strength" is a measure of of how similar/different the finger's state is to what the system considers "grabbing"; for a more detailed overview, see the documentation for IHand.GetFingerPinchStrength(HandFinger).
Signature
static float Oculus.Interaction.HandGrab.HandGrabInteraction.ComputeHandGrabScore(IHandGrabInteractor handGrabInteractor, IHandGrabInteractable handGrabInteractable, out GrabTypeFlags handGrabTypes, bool includeSelecting=false)
Parameters
handGrabInteractor: IHandGrabInteractor  The interactor grabbing
handGrabInteractable: IHandGrabInteractable  The interactable being grabbed
handGrabTypes: out GrabTypeFlags  A filter for the grab types to calculate
includeSelecting: bool  Compute also fingers that are selecting
Returns
float  The maximum strength for the grabbing fingers, normalized
ComputeShouldSelect ( handGrabInteractor , handGrabInteractable )
Extension method for IHandGrabInteractor which calculates whether the interactor should select a given IHandGrabInteractable.
This is conceptually related to Interactor<TInteractor, TInteractable>.ComputeShouldSelect, but rather than being a specific part of the general processing flow it's used in several places throughout the grab interaction logic.
Signature
static GrabTypeFlags Oculus.Interaction.HandGrab.HandGrabInteraction.ComputeShouldSelect(this IHandGrabInteractor handGrabInteractor, IHandGrabInteractable handGrabInteractable)
Parameters
handGrabInteractor: this IHandGrabInteractor  The interactor
handGrabInteractable: IHandGrabInteractable  The interactable
Returns
GrabTypeFlags  True if the handGrabInteractor should select (grab) the handGrabInteractable , false otherwise
ComputeShouldUnselect ( handGrabInteractor , handGrabInteractable )
Extension method for IHandGrabInteractor which calculates whether the interactor should unselect a given IHandGrabInteractable.
This is conceptually related to Interactor<TInteractor, TInteractable>.ComputeShouldUnselect, but rather than being a specific part of the general processing flow it's used in several places throughout the grab interaction logic.
Signature
static GrabTypeFlags Oculus.Interaction.HandGrab.HandGrabInteraction.ComputeShouldUnselect(this IHandGrabInteractor handGrabInteractor, IHandGrabInteractable handGrabInteractable)
Parameters
handGrabInteractor: this IHandGrabInteractor  The interactor
handGrabInteractable: IHandGrabInteractable  The interactable
Returns
GrabTypeFlags  True if the handGrabInteractor should unselect (release) the handGrabInteractable , false otherwise
CurrentGrabType ( handGrabInteractor )
Obsolete: this is a convenience method for retrieving the current grab type from an IHandGrabInteractor.
This method should not be used in new code; the value can instead be directly retrieved from the HandGrabTarget.Anchor property of the interactor's IHandGrabState.HandGrabTarget: handGrabInteractor.HandGrabTarget.Anchor.
Signature
static GrabTypeFlags Oculus.Interaction.HandGrab.HandGrabInteraction.CurrentGrabType(this IHandGrabInteractor handGrabInteractor)
Parameters
handGrabInteractor: this IHandGrabInteractor  The interactor to query for its current grab type
Returns
GrabTypeFlags  The current grab type of the interactor
GenerateMovement ( handGrabInteractor , interactable )
Initiates the movement of the IHandGrabInteractable with the current HandGrabTarget.
Signature
static IMovement Oculus.Interaction.HandGrab.HandGrabInteraction.GenerateMovement(this IHandGrabInteractor handGrabInteractor, IHandGrabInteractable interactable)
Parameters
handGrabInteractor: this IHandGrabInteractor  The interactor grabbing
interactable: IHandGrabInteractable  The interactable to be HandGrabbed
Returns
IMovement
GetGrabOffset ( handGrabInteractor )
Extension method for IHandGrabInteractor which calculates the offset from the wrist to the actual grabbing point defined by the current anchor in the interactor HandGrabTarget.
Signature
static Pose Oculus.Interaction.HandGrab.HandGrabInteraction.GetGrabOffset(this IHandGrabInteractor handGrabInteractor)
Parameters
handGrabInteractor: this IHandGrabInteractor  The interactor whose HandGrabTarget to inspect
Returns
Pose  The local offset from the wrist to the grab point
GetHandGrabPose ( handGrabInteractor )
Extension method for IHandGrabInteractor which retrivies the current pose of the current grabbing point.
Signature
static Pose Oculus.Interaction.HandGrab.HandGrabInteraction.GetHandGrabPose(this IHandGrabInteractor handGrabInteractor)
Parameters
handGrabInteractor: this IHandGrabInteractor
Returns
Pose  The pose of the current grabbing point in world space
GetPoseOffset ( handGrabInteractor , anchorMode , pose , offset )
Extension method for IHandGrabInteractor which calculates the root of a grab and the practical offset to the grabbing point.
Signature
static void Oculus.Interaction.HandGrab.HandGrabInteraction.GetPoseOffset(this IHandGrabInteractor handGrabInteractor, GrabTypeFlags anchorMode, out Pose pose, out Pose offset)
Parameters
handGrabInteractor: this IHandGrabInteractor  The interactor grabbing
anchorMode: GrabTypeFlags  The grab types to be used
pose: out Pose  The root of the grab pose to use
offset: out Pose  The offset form the root for accurate scoring
Returns
void
GetPoseScore ( handGrabInteractor , interactable , grabTypes , result )
Extension method for IHandGrabInteractor which calculates the GrabPoseScore for a given interactable with the specified grab modes.
Signature
static GrabPoseScore Oculus.Interaction.HandGrab.HandGrabInteraction.GetPoseScore(this IHandGrabInteractor handGrabInteractor, IHandGrabInteractable interactable, GrabTypeFlags grabTypes, ref HandGrabResult result)
Parameters
handGrabInteractor: this IHandGrabInteractor  The interactor grabbing
interactable: IHandGrabInteractable  The interactable to measure to
grabTypes: GrabTypeFlags  The supported grab types for the grab
result: ref HandGrabResult  Calculating the score requires finding the best grab pose. It is stored here.
Returns
GrabPoseScore  The best GrabPoseScore considering the grabtypes at the interactable
GrabbingFingers ( handGrabInteractor , handGrabInteractable )
Extension method for IHandGrabInteractor which builds a bit flag enumeration of the fingers which are currently considered to be grabbing.
Note that, because the returned value is a bit mask, it should not be checked directly against enum values as it may not appear in the enum at all. Instead, bitwise operations should be used to check for the presence of enum values within the mask: i.e., (mask & <see cref="HandFingerFlags.Thumb"/>) != 0.
Signature
static HandFingerFlags Oculus.Interaction.HandGrab.HandGrabInteraction.GrabbingFingers(this IHandGrabInteractor handGrabInteractor, IHandGrabInteractable handGrabInteractable)
Parameters
handGrabInteractor: this IHandGrabInteractor  The interactor
handGrabInteractable: IHandGrabInteractable  The interactable being grabbed
Returns
HandFingerFlags  A bit mask of HandFingerFlags values indicating which fingers are currently grabbing
TryCalculateBestGrab ( handGrabInteractor , interactable , grabTypes , anchorMode , handGrabResult )
Obsolete: Calculates a new target.
That is the point of the interactable at which the hand grab interaction will occur. This function is obsolete and should be replaced by calls to CalculateBestGrab(IHandGrabInteractor, IHandGrabInteractable, GrabTypeFlags, out GrabTypeFlags, ref HandGrabResult) in new code.
Signature
static bool Oculus.Interaction.HandGrab.HandGrabInteraction.TryCalculateBestGrab(this IHandGrabInteractor handGrabInteractor, IHandGrabInteractable interactable, GrabTypeFlags grabTypes, out HandGrabTarget.GrabAnchor anchorMode, ref HandGrabResult handGrabResult)
Parameters
handGrabInteractor: this IHandGrabInteractor
interactable: IHandGrabInteractable  The interactable to be HandGrabbed
grabTypes: GrabTypeFlags  The supported GrabTypes
anchorMode: out HandGrabTarget.GrabAnchor  The anchor to use for grabbing
handGrabResult: ref HandGrabResult  The a variable to store the result
Returns
bool  True if a valid pose was found