API

Function attachFreeControl

  • Attach keyboard + mouse controls to a FreeCamera. Matches Babylon.js FreeCamera input behavior:

    • Mouse drag or pointer-lock: look around (yaw/pitch)
    • Arrow keys / WASD: move forward/back/strafe
    • PageUp/PageDown or Space/Shift: move up/down
    • Inertia: movement decays smoothly (camera.inertia, default 0.9)
    • Frame-rate independent: uses deltaTime from render loop

    Camera stays plain data — this function reads/writes its properties. Returns a cleanup function to remove all listeners and the beforeRender hook.

    Parameters

    Returns () => void