@@ -4,8 +4,9 @@ import { Physics, usePlane } from '@react-three/cannon'
4
4
import { Cursor } from './helpers/Drag.js'
5
5
import { Guy } from './components/Guy.jsx'
6
6
import { Mug , Chair , Table , Lamp } from './components/Furniture.jsx'
7
- import { createXRStore , XR , XROrigin } from '@react-three/xr'
8
- import { Suspense } from 'react'
7
+ import { createXRStore , useControllerLocomotion , XR , XROrigin } from '@react-three/xr'
8
+ import { useRef , Suspense } from 'react'
9
+ import { Group } from 'three'
9
10
10
11
const store = createXRStore ( {
11
12
hand : { touchPointer : false } ,
@@ -55,14 +56,20 @@ export function App() {
55
56
</ Physics >
56
57
</ Suspense >
57
58
< group position = { [ 0 , - 5 , 0 ] } >
58
- < XROrigin scale = { 10 } />
59
+ < ControlledXROrigin />
59
60
</ group >
60
61
</ XR >
61
62
</ Canvas >
62
63
</ >
63
64
)
64
65
}
65
66
67
+ function ControlledXROrigin ( ) {
68
+ const ref = useRef ( null )
69
+ useControllerLocomotion ( ref , { speed : 10 } )
70
+ return < XROrigin ref = { ref } scale = { 10 } />
71
+ }
72
+
66
73
function Floor ( props ) {
67
74
const [ ref ] = usePlane ( ( ) => ( { type : 'Static' , ...props } ) )
68
75
return (
0 commit comments