UNPKG

@threlte/xr

Version:

Tools to more easily create VR and AR experiences with Threlte

20 lines (19 loc) 603 B
import { currentWritable } from '@threlte/core'; export const left = currentWritable(undefined); export const right = currentWritable(undefined); export const gaze = currentWritable(undefined); /** * Provides a reference to a current XRController, filtered by handedness. */ export const useController = (handedness) => { switch (handedness) { case 'left': return left; case 'right': return right; case 'none': return gaze; default: throw new Error('useController handedness must be left, right, or none.'); } };