pmndrs / xr

🤳 VR/AR for react-three-fiber
https://pmndrs.github.io/xr/docs/
Other
2.1k stars 151 forks source link

First Person Controls inside VR mode #222

Closed carolinaroqu3 closed 1 month ago

carolinaroqu3 commented 1 year ago

Is there any possibility to use the joystick controls of the glasses to move the camera and walk around the scene?

snettah commented 1 year ago

https://github.com/pmndrs/react-xr/issues/218 here

rekliner commented 1 year ago

@carolinaroqu3 as others pointed out useController() is what you are looking for. For a working component you can drop in check out https://codesandbox.io/s/three-fiber-xr-headset-camera-bounds-box-tin2ko?file=/components/MovementController.js

ofc there is a lot of context on how you want movement to work in your personal project...factors like speed, gravity, collision, acceleration, tilt,...etc. You will eventually be coding for your own solution. The sky is the limit, but this simple example should get you started for basic movement.

bbohlender commented 1 month ago

Since the answer to this question has changed slightly in v6, I am linking to a simple tutorial that introduces how to implement locomotion for controlling the viewers position by controlling its origin.