threlte logo
@threlte/xr

useHeadset

Provides a reference to the user’s headset pose.

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

  const headset = useHeadset()

  useFrame(() => {
    // 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()