threlte logo
@threlte/xr

useGamepad

Provides a reference to the gamepad attached to a current XRController.

<script>
  import { useGamepad } from '@threlte/xr'

  const leftPad = useGamepad('left')
  const rightPad = useGamepad('right')
</script>

Signature

// CurrentWritable<Gamepad | undefined> - The current Gamepad
const controller = useController('left')