threlte logo
@threlte/xr

useHeadset

Provides a reference to the user’s headset pose.

<script>
  import { useTask } from '@threlte/core'
  import { useHeadset } from '@threlte/xr'

  const headset = useHeadset()

  useTask(() => {
    // Read the current headset position and rotation.
    console.log(headset.position, headset.quaternion)
  })
</script>

If you would like to attach objects to the headset, the <Headset> component is available.

Signature

// THREE.Group - A group representing the headset pose.
const headset = useHeadset()