react-xr

VR/AR with react-three-fiber

README

@react-three/xr

Version Downloads Discord Shield

React components and hooks for creating VR/AR applications with @react-three/fiber

  1. ``` sh
  2. npm install @react-three/xr
  3. ```

Examples


These demos are real, you can click them! They contain the full code, too.


Getting started


The following adds a button to start your session and controllers inside an XR manager to prepare your scene for WebXR rendering and interaction.

  1. ``` js
  2. import { VRButton, ARButton, XR, Controllers, Hands } from '@react-three/xr'
  3. import { Canvas } from '@react-three/fiber'

  4. function App() {
  5.   return (
  6.     <>
  7.       <VRButton />
  8.       <Canvas>
  9.         <XR>
  10.           <Controllers />
  11.           <Hands />
  12.           <mesh>
  13.             <boxGeometry />
  14.             <meshBasicMaterial color="blue" />
  15.           </mesh>
  16.         </XR>
  17.       </Canvas>
  18.     </>
  19.   )
  20. }
  21. ```

XRButton


`` is an HTML `