Skip to main content

HoldOntoBehaviour

Description

The HoldOntoBehaviour component enhances immersion by ensuring that the visualized controller or hand firmly "holds onto" an interactable object during interaction. Instead of relying on raw sensor data for positioning, this behavior locks the controller to the object, making it ideal for realistic interactions with door knobs, levers, and similar objects.

Properties

Component inspector
Component inspector
NameDescription
Sorting OrderBehaviours with a higher sorting order will always be executed after the ones with a lower sorting order.
Target HandednessThe handedness of the interactor to perform the Behaviour for. The Behaviour will only be performed, if the handedness is a match.
HintOptional: The pose to hold / grab onto when locking onto this interactable. Must be a child transform of the component transform. If not set, the component transform is used.
SmoothIf set, the controller visualizer will smoothly lock to the interactable instead of instantly.
Smoothing DurationDuration in seconds to sync the visualizer pose with the interactable. The value is in seconds per unit and will interpolate based on distance. So if the visualizer is 5 units away, the total sync duration is five times the configured duration.

Setup

  1. Add the Interactable component to the GameObject you want to interact with and use the HoldOntoBehaviour with
  2. Configure the GameObject's Rigidbody and Collider as per your requirements
  3. Add the HoldOntoBehaviour to the GameObject
  4. Optional: Add a child Transform to the interactable GameObject and assign it to the HoldOntoBehaviour's hint property in the inspector. Use it to configure the grab pose of the controller visualizer on the interactable
  5. Optional: You can add multiple HoldOntoBehaviours to the interactable should you need to adjust confugration depending on the controller's handedness
  6. Optional: Add a GrabHandPoseBehaviour to define a hand pose when grabbing / holding onto the interactable object

Example

Example setup inspector
Example setup inspector

Resources

Additional samples and tutorials coming soon.