Skip to main content
File: Assets/_MolcaSDK/_VR/Scripts/Interactions/ValveInteraction.cs
Base: MolcaInteractionBase

Setup

XRGrabInteractable on the handle + ValveInteraction + optional ReferenceableComponent for ValveStep.

When to use

Use Valve Interaction when a VR training scene needs a physical control the trainee manipulates. Works with the matching step type (e.g. Valve Interaction pairs with valve-interaction). Configure in Inspector.

Role

Projects hand motion onto a plane, drives handle rotation, exposes angle subscriptions and limits (see serialized fields and public API in source).

Code

Inspector UnityEvent hooks are the usual integration path. From code, the same events are exposed as fields on ValveInteraction:

Troubleshooting

  • Handle does not rotate — Check valveHandle, rotationAxis, lock state, and that XRGrabInteractable fires select events on this rig.
  • Target angle never reachedValveStep uses SubscribeToAngle against accumulated rotation; align targetAngle with min/max clamp and startAngle.
  • Jitter or axis wrong — Toggle useInteractableTransform vs explicit handle; verify axis is in handle local space.

Unity Editor

Scene view: hand on valve + Inspector: ValveInteraction fields (handle, axis, limits).

ValveInteraction in Unity Inspector

ValveInteraction setup