ExistentGrabComponent

Overview

The ExistentGrabComponent makes use of the calculated wrist transform to understand when the user grabs and releases an object or when switching between grips while holding an object.

The component can be in 3 different states:

  • Looking for grabbable objects: in this state the component detects the best available grips around the hand and provides the ExistentHandComponent with the calculated transforms for the currently selected grip (if available).

  • Holding an object: in this state the component keeps track of the distance between the physical wrist transform and the selected grip transform to understand when the user has let go of the object.

  • Transferring grip: while the user holds an object the component keeps monitoring the physical wrist transform to understand if a better grip has become available. If the latter happens to be the case the ExistentGrabComponent will support the ExistentHandComponent in transferring from the current grip to the new grip.

How to use

Unless you are using a custom setup your player class will inherit from ExistentPlayer, which will already provide you with the two ExistentGrabComponents required.

If this is not the case the ExistentGrabComponent can be added to your player class by using the Add button in the components panel inside the blueprint editor. Once added you must specify which hand the component will work with, either left or right, as well as the skeletal mesh component the ExistentGrabComponent will work with. The component works in tandem with the ExistentHandComponent which will have to be added to the player class for each hand.

While the component comes with sensible grip detection default values the following grip sub-categories contain a number of properties that can be changed to customise its behaviour:

  • Trace: The properties in this subcategory control how the grab component will trace for actors that may contain suitable grip components.

  • Attach: The properties in this subcategory control how the grab component will attempt to attach the hand to a grip. The grip range and grip delta are used to compare the wrist transform with the best grip candidate and decide if the grip is close enough to attach to it.

  • Detach: The properties in this subcategory control how the grab component would detect the hand letting go of an object. The detach grip range and detach grip delta are used to compare the wrist transform with the selected grip and decide if the hand should detach from the grip.

  • Transfer: The properties in this subcategory control whether or not another available grip from the object held has become a more suitable grip based on the current wrist transform.

Additional Details

  • Initialization and Runtime Behavior: Upon initialization, UExistentGrabComponent configures itself based on specified settings such as the associated hand (left or right), skeletal mesh component name for the player's body, and collision objects for grip detection. During runtime, it actively performs sphere traces to identify potential grab targets, calculating the optimal grip based on proximity and orientation relative to the user's hand.

  • Events and Callbacks: Supports multiple events such as OnGripAttach, OnGripDetach, and OnGripTransfer, enabling custom logic to be executed when users grab, release, or transfer objects between grips. This extensibility allows for complex interaction patterns and feedback mechanisms to be implemented, enhancing the overall user experience.

  • Debugging and Customization Commands: Developers can use console commands to dynamically adjust grab component settings in the editor or during gameplay, such as modifying grip range, delta, and thresholds. This flexibility aids in fine-tuning interaction parameters to achieve desired behaviours and interaction fidelity.