Assets/_MolcaSDK/_VR/Scripts/Scenario/Steps/GrabStep.csBase: Step
Role
Completes when the trainee grabs and/or releases anXRGrabInteractable according to serialized rules (auto-find interactable, required interactor, hold duration, optional position checks).
Inspector
All behavior is driven bySerializeField definitions on the component — use the Inspector as the contract for designers.
Code
Completion paths (fromselectEntered / selectExited on grabInteractable):
completeOnGrabwithoutrequireHoldDuration—CompleteGrab()runs on grab ifValidateGrabPosition()passes.requireHoldDuration—UpdateStepcompletes once hold time ≥minGrabDurationandcompleteOnGrabis true.completeOnRelease— completes on release if not already completed.ForceComplete()— bypasses position checks after setting internal completed flag.
Troubleshooting
- Console: no XRGrabInteractable found — Assign
grabInteractableor enableautoFindInteractableand put aXRGrabInteractableon this object or a child. - Grab registers but step never completes — Check
completeOnGrabvscompleteOnRelease,requireHoldDuration/minGrabDuration, interactor filters (allowAnyInteractor/requiredInteractor), and position requirement (targetPosition+positionTolerance). - Wrong hand counts — Set
requireSpecificInteractorand assign theXRBaseInteractorfor the intended controller.
Related
- Step (base class) — lifecycle and
Complete() - VR player manager — disable locomotion during precision grabs
- VR inventory — storing grabbed props
Unity Editor
GrabStep on a prop with XRGrabInteractable in same hierarchy.
