HandPosing
A tool for quickly authoring hand poses to objects in VR using hand-tracking
HandPosing.Interaction.BaseGrabber Class Referenceabstract

Sample implementation for a Grabber (without dependencies) that works with the snapping system. Inherit from this class to be able to reuse the provided Grabber-Grabbable classes or completely implement (or adapt!) your own by implementing the much smaller IGrabNotifier. This grabbed does not only takes care of detecting a grab but also if the user intended to grab and it failed. More...

Inheritance diagram for HandPosing.Interaction.BaseGrabber:
HandPosing.Interaction.IGrabNotifier HandPosing.OVRIntegration.GrabberHybridOVR

Public Member Functions

abstract float CurrentFlex ()
 Current normalised value of the grabbing gesture. 1 for a fully realised gesture, 0 for no gesture detected. More...
 
Snappable FindClosestSnappable ()
 The snappable with the best score that can be reached at the current pose. Typically all grabbable objects will also have snappables, and the Grabber would already implement a metho to find the nearest grabbable,this could be very similar. More...
 
void ForceRelease (Grabbable grabbable)
 Release a grabbable from this grabber. More...
 
void ForceUntouch (Grabbable grabbable)
 Unsuscribe an object from the list of touched grabbables. The object will not be a grabbing candidate until it is touched again. More...
 
virtual void OffhandGrabbed (Grabbable grabbable)
 Release an object without throwing it. More...
 
void OnTriggerEnter (Collider otherCollider)
 
void OnTriggerExit (Collider otherCollider)
 

Static Public Member Functions

static void ClearAllGrabs (Grabbable grabbable)
 Unsuscribe all the objects grabbed by all hands. More...
 

Public Attributes

Action< GameObject, float > OnGrabTimedEnded
 Callback indicating that a grab finished and how long it was held. More...
 

Protected Member Functions

virtual void Reset ()
 
virtual void Awake ()
 
virtual void OnEnable ()
 
virtual void OnDisable ()
 
virtual void OnDestroy ()
 
virtual void Update ()
 
void CheckForGrabOrRelease (float prevFlex, float currentFlex)
 Checks the current grabbing gesture and tries to grab/release/approach a grabbable. This key method triggers the callbacks for the snapping system. More...
 
virtual void GrabFailed ()
 When a grab attempt fails, set the state accordingly and trigger the relevant callbacks like OnGrabAttemptFail More...
 
void NearGrab (float factor)
 Triggers how close the grabber is to start grabbing a nearby object, informing the snapping system. More...
 
virtual void GrabBegin ()
 Search for a nearby object and grab it. More...
 
virtual void Grab (Grabbable closestGrabbable)
 Attach a given grabbable to the hand, storing the offset to the hand so it can be kept while holding. More...
 
virtual void MoveGrabbedObject (Vector3 pos, Quaternion rot)
 Update the grabbed object position/rotation using the offset recorded when the grab started. More...
 
virtual void GrabEnd (bool canGrab=true)
 Releases the current grabbed object More...
 
void ReleaseGrabbedObject (Vector3 linearVelocity, Vector3 angularVelocity)
 Throw the current grabbed object. More...
 
Grabbable FindClosestGrabbable ()
 

Protected Attributes

abstract Vector3
 Relative velocities of the hand for throwing. More...
 

Properties

Grabbable GrabbedObject = null [get]
 Current grabbed object. More...
 
Action< bool > OnIgnoreTriggers [get, set]
 Callback that indicates that the detection trigger has been enabled/disabled More...
 
Action< GameObject > OnGrabStarted [get, set]
 
Action< GameObject, float > OnGrabAttemp [get, set]
 
Action< GameObject > OnGrabEnded [get, set]
 
Action< GameObject > OnGrabAttemptFail [get, set]
 
abstract Vector2 GrabFlexThreshold [get]
 
abstract Vector2 GrabAttemptThreshold [get]
 Range for detecting that grab failed. Typically narrower than GrabFlexThreshold. More...
 
abstract float ReleasedFlexThreshold [get]
 Indicates the minimum value for a grab Typically a bit higher than the minimum GrabFlexThreshold More...
 
- Properties inherited from HandPosing.Interaction.IGrabNotifier
Action< GameObject > OnGrabStarted [get, set]
 Event triggered when a Grab is started at a GameObject. More...
 
Action< GameObject, float > OnGrabAttemp [get, set]
 Event triggered when a Grab is attempted at a GameObject. More...
 
Action< GameObject > OnGrabAttemptFail [get, set]
 Event triggered when a grabbed GameObjec if user tried to make a grab attempt sometime in the past More...
 
Action< GameObject > OnGrabEnded [get, set]
 Event triggered when a grabbed GameObject is released. More...
 
Vector2 GrabFlexThreshold [get]
 Min - Max value for the grab thresold. X indicates the release point, Y the grab point. Typically [0.33,0.9] or even [0,1] More...
 

Detailed Description

Sample implementation for a Grabber (without dependencies) that works with the snapping system. Inherit from this class to be able to reuse the provided Grabber-Grabbable classes or completely implement (or adapt!) your own by implementing the much smaller IGrabNotifier. This grabbed does not only takes care of detecting a grab but also if the user intended to grab and it failed.

Member Function Documentation

◆ CheckForGrabOrRelease()

void HandPosing.Interaction.BaseGrabber.CheckForGrabOrRelease ( float  prevFlex,
float  currentFlex 
)
protected

Checks the current grabbing gesture and tries to grab/release/approach a grabbable. This key method triggers the callbacks for the snapping system.

Parameters
prevFlexLast grabbing gesture strength, normalised.
currentFlexCurrent gragginb gesture strength, normalised.

◆ ClearAllGrabs()

static void HandPosing.Interaction.BaseGrabber.ClearAllGrabs ( Grabbable  grabbable)
static

Unsuscribe all the objects grabbed by all hands.

Parameters
grabbable

◆ CurrentFlex()

abstract float HandPosing.Interaction.BaseGrabber.CurrentFlex ( )
pure virtual

Current normalised value of the grabbing gesture. 1 for a fully realised gesture, 0 for no gesture detected.

Returns
Normalised value for the grab gesture detection.

Implements HandPosing.Interaction.IGrabNotifier.

Implemented in HandPosing.OVRIntegration.GrabberHybridOVR.

◆ FindClosestSnappable()

Snappable HandPosing.Interaction.BaseGrabber.FindClosestSnappable ( )

The snappable with the best score that can be reached at the current pose. Typically all grabbable objects will also have snappables, and the Grabber would already implement a metho to find the nearest grabbable,this could be very similar.

Returns
If found, the best object that the hand can snap to.

Implements HandPosing.Interaction.IGrabNotifier.

◆ ForceRelease()

void HandPosing.Interaction.BaseGrabber.ForceRelease ( Grabbable  grabbable)

Release a grabbable from this grabber.

Parameters
grabbableThe grabbable to be released.

◆ ForceUntouch()

void HandPosing.Interaction.BaseGrabber.ForceUntouch ( Grabbable  grabbable)

Unsuscribe an object from the list of touched grabbables. The object will not be a grabbing candidate until it is touched again.

Parameters
grabbableThe grabbable to be unsuscribed

◆ Grab()

virtual void HandPosing.Interaction.BaseGrabber.Grab ( Grabbable  closestGrabbable)
protectedvirtual

Attach a given grabbable to the hand, storing the offset to the hand so it can be kept while holding.

Parameters
closestGrabbableThe object to be grabbed.

Reimplemented in HandPosing.OVRIntegration.GrabberHybridOVR.

◆ GrabBegin()

virtual void HandPosing.Interaction.BaseGrabber.GrabBegin ( )
protectedvirtual

Search for a nearby object and grab it.

◆ GrabEnd()

virtual void HandPosing.Interaction.BaseGrabber.GrabEnd ( bool  canGrab = true)
protectedvirtual

Releases the current grabbed object

Parameters
canGrabIf the hand can grab again anything within reach after this release. Set False if the grab was ended artifially, not by the user actually ungrasping.

◆ GrabFailed()

virtual void HandPosing.Interaction.BaseGrabber.GrabFailed ( )
protectedvirtual

When a grab attempt fails, set the state accordingly and trigger the relevant callbacks like OnGrabAttemptFail

◆ MoveGrabbedObject()

virtual void HandPosing.Interaction.BaseGrabber.MoveGrabbedObject ( Vector3  pos,
Quaternion  rot 
)
protectedvirtual

Update the grabbed object position/rotation using the offset recorded when the grab started.

Parameters
posCurrent position of the grabber.
rotCurrent rotation of the grabber.

◆ NearGrab()

void HandPosing.Interaction.BaseGrabber.NearGrab ( float  factor)
protected

Triggers how close the grabber is to start grabbing a nearby object, informing the snapping system.

Parameters
factorCurrent normalised value for the grab attemp, 1 indicates a grab.

◆ OffhandGrabbed()

virtual void HandPosing.Interaction.BaseGrabber.OffhandGrabbed ( Grabbable  grabbable)
virtual

Release an object without throwing it.

Parameters
grabbableObject to release

◆ ReleaseGrabbedObject()

void HandPosing.Interaction.BaseGrabber.ReleaseGrabbedObject ( Vector3  linearVelocity,
Vector3  angularVelocity 
)
protected

Throw the current grabbed object.

Parameters
linearVelocityLinear velocity of the throw.
angularVelocityAngular velocity of the throw.

Member Data Documentation

◆ OnGrabTimedEnded

Action<GameObject, float> HandPosing.Interaction.BaseGrabber.OnGrabTimedEnded

Callback indicating that a grab finished and how long it was held.

◆ Vector3

abstract HandPosing.Interaction.BaseGrabber.Vector3
protected

Relative velocities of the hand for throwing.

Parameters
toThe point at which to measure the velocity.
Returns
The linear and angular velocity of the hand at the given pose.

Property Documentation

◆ GrabAttemptThreshold

abstract Vector2 HandPosing.Interaction.BaseGrabber.GrabAttemptThreshold
get

Range for detecting that grab failed. Typically narrower than GrabFlexThreshold.

◆ GrabbedObject

Grabbable HandPosing.Interaction.BaseGrabber.GrabbedObject = null
get

Current grabbed object.

◆ OnIgnoreTriggers

Action<bool> HandPosing.Interaction.BaseGrabber.OnIgnoreTriggers
getset

Callback that indicates that the detection trigger has been enabled/disabled

◆ ReleasedFlexThreshold

abstract float HandPosing.Interaction.BaseGrabber.ReleasedFlexThreshold
get

Indicates the minimum value for a grab Typically a bit higher than the minimum GrabFlexThreshold


The documentation for this class was generated from the following file: