PX
2.6Kย stars Quality 64 Trend 78NOASSERTION

๐Ÿคณ VR/AR for react-three-fiber

Overview

xr Turn any R3F app into an interactive immersive experience. 1. const store = createXRStore() create a xr store 2. store.enterAR() call enter AR when clicking on a button 3. ... wrap your content with the XR component ... or read this guide for converting a react-three/fiber app to XR. - ๐Ÿ’พ Store - ๐Ÿ‘† Interactions - ๐Ÿ‘Œ Handles - ๐ŸงŠ Object Detection - โœด Origin - ๐Ÿช„ Teleport - ๐Ÿ•น๏ธ Gamepad - โž• Secondary Input Sources - ๐Ÿ“บ Layers - ๐ŸŽฎ Custom Controller/Hands/... - โš“๏ธ Anchors - ๐Ÿ“ฑ Dom Overlays - ๐ŸŽฏ Hit Test - โ›จ Guards - from @react-three/xr v5 - from natuerlich This package ships a usage skill for coding agents, matching the installed version. Install it with skills-npm, which links the skills of your installed packages for your agent: This project is supported by a few companies and individuals building cutting-edge 3D Web & XR experiences. Check them out!

README

xr Turn any R3F app into an interactive immersive experience.

npm install three @react-three/fiber @react-three/xr@latest

What does it look like?

A simple scene with a mesh that toggles its material color between "red" and "blue" when clicked through touching or pointing.
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 (
    <>
       store.enterAR()}>Enter AR
      
        
           setRed(!red)} position={[0, 1, -1]}>
            
            
          
        
      
    
  )
}

How to enable XR for your @react-three/fiber app?

  1. const store = createXRStore() create a xr store
  2. store.enterAR() call enter AR when clicking on a button
  3. ... wrap your content with the XR component

โ€ฆ or read this guide for converting a react-three/fiber app to XR.

Tutorials

External Tutorials

Migration guides

Agent skills

This package ships a usage skill for coding agents, matching the installed version. Install it with skills-npm, which links the skills of your installed packages for your agent:

npm i -D skills-npm
npx skills-npm setup

Sponsors

This project is supported by a few companies and individuals building cutting-edge 3D Web & XR experiences. Check them out!

View this README on GitHub

Recommended Tools

Try a different keyword or remove a filter.

Install

npx skillfish add pmndrs/xr