Snapper

Introduction

Snapper module is responsible for finding object that can be grabbed (candidates), using Poser module to generate the grabbing pose for an object, applying that pose to the slave hand, attract the object to slave hand and ensure that the object is properly snapped as well as detecting when the user does not want to keep grabbing the object.

Snap interaction

The snap interaction is performed as follows:

  1. Search: While the user performs and maintains the search gesture, Snapper module will search for candidate objects to be snapped, moving an indicator to the snap point of the closer candidate found.

  2. Attraction: If the user performs a selection gesture, the grabbing pose will be calculated and applied to slave hand, then its pose will be locked and collissions between the object and slave hand bones will be disabled until the snap process is completed. A new physics constraint will be added to attract the object to slave hand palm using physics. Selection gesture can vary between objects as well as the configuration of the physics constraint used to attract them.

  3. Snap: Once the object is completely attracted and maintains its position close to slave hand palm, the locked pose can become partially unlocked, collisions between the object and slave hand can be resumed and the previously created physics constraint can become stronger. Again, the configuration of the physics constraint used to maintain the object attached to slave hand palm, the degree of freedom and the ability to collide with the object that slave finger bones will have while having the object snapped can be fine-tuned for each object.

  4. Unsnap: When the user stops performing the selection gesture, the physics constraint will be removed, the object will be realeased and slave finger bones will recover its movility and ability to collide with the object.

Model

  • Hand: Parent model (HandModel) that this module will be connected to.

Searching

  • Indicator: Object that will be placed in candidate snap points while the user is searching for objects to snap.

  • Search Gesture: Gesture that will trigger candidate search.

  • Min Gesture Lerp To Search: Gesture threshold to trigger candidate search.

  • Max Candidate Distance: Objects beyond this distance will never be considered as candidates.

  • Time Selecting To Attract: It represents for how long has the user to perform selection gesture before starting attraction. This gesture is specified in Snapper.customSelectionGesture.

  • Search Candidates Close To: Hand representation key which hand plam will act as origin.

  • Availability: It represents when is the Snapper module available to search and attract new candidates.

Attraction

  • Min Distance To Complete Snap: Distance threshold under which the object must stay to be considered as attracted.

  • Time In Min Distance To Snap: Time the object must stay under the distance threshold to be considered as properly snapped.

  • Custom Selection Gesture: Gesture to attract candidates where Snappable.selectionGesture is Custom.

  • Attraction Motion Drive: Motion drive properties that will be applied to the physics constraint (ConfigurableJoint) created to attract the object to hand palm when the snappable object is not overwriting its drives (SnappableView.useTheseAttractionDrives is false).

  • Attraction Angular Drive: Angular drive properties that will be applied to the physics constraint (ConfigurableJoint) created to attract the object to hand palm when the snappable object is not overwriting its drives (SnappableView.useTheseAttractionDrives is false).

Snapping

  • Refresh Pose Lock: If enabled, pose will be updated every frame. This is useful to adapt hand pose to a changing object or a changing hand while being snapped. Although, this option can affect performance negatively.

  • Drives Are Relative To Size: If enabled, SnapperModel.snapMotionDrive.maxForce and SnapperModel.snapAngularDrive.maxForce will be multiplied by Snapper.hand.totalScale.

  • Snap Motion Drive: Motion drive properties that will be applied to the physics constraint (ConfigurableJoint) created to maintain the object attached to hand palm when the snappable object is not overwriting its drives (SnappableView.useTheseSnapDrives is false).

  • Snap Angular Drive: Angular drive properties that will be applied to the physics constraint (ConfigurableJoint) created to maintain the object attached to hand palm when the snappable object is not overwriting its drives (SnappableView.useTheseSnapDrives is false).

Debug

  • Show Ignored: Axis will be shown for bones that are not colliding with the snapped object.

  • Stop Gesture To Unsnap: If disabled, gestures will be ignored and snapping/unsnapping will only be possible by calling the functions SnapperView.ForceSnap() and SnapperView.ForceUnsnap().

Read Only

  • Ignoring Collisions With: List of objects which collisions with slave finger bones have been disabled.

  • Gesture Detector: GestureDetection module found automatically.

  • Contact Detector: ContactDetection module found automatically.

  • Time Selecting: Total time that SnapperModel.selectionGesture.lerp is being greater than SnapperModel.candidate.minGestureLerpToSelect.

  • Time Snapped: Total time that distance between candidate's snap point and slave hand palm is lower than SnapperModel.minDistanceToCompleteSnap.

  • Poser: Poser module found automatically.

  • Selection Gesture: Gesture that should be performed to attract the candidate object found during search.

  • Searching: If enabled, Snapper module is searching for candidates every frame.

Properties

  • Candidate: This value represents the result of candidate search. If SnapperModel.searchGesture is not being performed, there are no available objects close or the object is already being attracted or snapped, this value will be null. If a candidate was found, SnapperModel.indicator will be moved to SnapperModel.candidate.GetTransformRef(model.hand.side).position.

  • Snapped: If enabled, an object is already being properly attached to slave hand palm.

  • Step: State of snap interaction: none, attracting or snapped.

View

Events

  • On New Candidate: Invoked when SnapperModel.candiate change its value for a different not null value.

  • On Attract: Invoked when the candidate is finally selected ans starts being attracted towards slave hand palm.

  • On Snap: Invoked when the object stabilizes near slave hand palm and snap is properly performed.

  • On Unsnap: Invoked when the selection gesture is no more performed and the object is released.

Last updated