> ## Documentation Index
> Fetch the complete documentation index at: https://docs-unity.molca.id/llms.txt
> Use this file to discover all available pages before exploring further.

# KnobInteraction

> Wrist-twist knob rotation with optional snap positions.

**File:** `Assets/_MolcaSDK/_VR/Scripts/Interactions/KnobInteraction.cs`\
**Base:** [MolcaInteractionBase](/vr/interactions/molca-interaction-base)

## When to use

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

## Role

Tracks wrist rotation around the knob axis, applies smoothing and optional **snap angles**.

## Setup

Same pattern as [Valve interaction](/vr/interactions/valve-interaction): `XRGrabInteractable` + component + references for [KnobStep](/vr/steps/knob-step).

## Code

Inspector **`onRotationChanged`**, **`onPositionChanged`**, **`onFullRotation`** match the [Valve interaction](/vr/interactions/valve-interaction) pattern:

```csharp theme={null}
using MolcaSDK.VR.Interactions;
using UnityEngine;

public class KnobFeedback : MonoBehaviour
{
    [SerializeField] private KnobInteraction knob;

    private void OnEnable()
    {
        knob.onRotationChanged.AddListener(OnAngle);
        knob.onPositionChanged.AddListener(OnSnap);
    }

    private void OnDisable()
    {
        knob.onRotationChanged.RemoveListener(OnAngle);
        knob.onPositionChanged.RemoveListener(OnSnap);
    }

    private void OnAngle(float degrees) { }
    private void OnSnap(int index) { }
}
```

## Troubleshooting

* **Snaps feel wrong** — Adjust **`snapPositions`** or disable **`snapToPositions`** for free rotation; **`startAngle`** must match your authored pose.
* **Same as valve: no grab** — Confirm **`MolcaInteractionBase`** / **`XRGrabInteractable`** setup per [MolcaInteractionBase](/vr/interactions/molca-interaction-base).
* **Step does not complete** — See [KnobStep](/vr/steps/knob-step) ( **`targetAngle`** vs snap indices).

## Unity Editor

<Frame hint="Knob prefab with KnobInteraction + snap positions array visible." caption="KnobInteraction Inspector">
  <img src="https://mintlify.s3.us-west-1.amazonaws.com/ptmolcateknologinusantara/images/features/vr/interactions/knob-interaction-inspector.png" alt="KnobInteraction in Unity Inspector" />
</Frame>
