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
Name | Description |
---|---|
Sorting Order | Behaviours with a higher sorting order will always be executed after the ones with a lower sorting order. |
Target Handedness | The handedness of the interactor to perform the Behaviour for. The Behaviour will only be performed, if the handedness is a match. |
Hint | Optional: 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. |
Smooth | If set, the controller visualizer will smoothly lock to the interactable instead of instantly. |
Smoothing Duration | Duration 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
- Add the
Interactable
component to theGameObject
you want to interact with and use theHoldOntoBehaviour
with - Configure the
GameObject
'sRigidbody
andCollider
as per your requirements - Add the
HoldOntoBehaviour
to theGameObject
- Optional: Add a child
Transform
to the interactableGameObject
and assign it to theHoldOntoBehaviour
'shint
property in the inspector. Use it to configure the grab pose of the controller visualizer on the interactable - Optional: You can add multiple
HoldOntoBehaviour
s to the interactable should you need to adjust confugration depending on the controller's handedness - Optional: Add a GrabHandPoseBehaviour to define a hand pose when grabbing / holding onto the interactable object
Example
Resources
Additional samples and tutorials coming soon.