VR/AR for react-three-fiber
npm install @react-three/xr
``bash`
npm install three @react-three/fiber @react-three/xr@latest
| A simple scene with a mesh that toggles its material color between "red" and "blue" when clicked through touching or pointing. | !recording of interacting with the code below |
| ---------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- |
`tsx
import { Canvas } from '@react-three/fiber'
import { XR, createXRStore } from '@react-three/xr'
import { useState } from 'react'
const store = createXRStore()
export function App() {
const [red, setRed] = useState(false)
return (
<>
>
)
}
`
1. const store = createXRStore() create a xr storestore.enterAR()
2. call enter AR when clicking on a button
3.
... or read this guide for converting a react-three/fiber app to XR.
- đž Store
- đ Interactions
- đ Handles
- đ§ Options
- đ§ Object Detection
- â´ Origin
- đĒ Teleport
- đšī¸ Gamepad
- â Secondary Input Sources
- đē Layers
- đŽ Custom Controller/Hands/...
- âī¸ Anchors
- đą Dom Overlays
- đ¯ Hit Test
- ⨠Guards
- đĨ WebXR First Steps React by Meta Quest
- đ¤ŗ XR Gestures
- đē Tracked Body
- from @react-three/xr v5
- from natuerlich
This project is supported by a few companies and individuals building cutting-edge 3D Web & XR experiences. Check them out!