How can react-three-fiber be used with vr?
See original GitHub issueOn:
https://threejs.org/docs/index.html#manual/en/introduction/How-to-create-VR-content
they explain:
Finally, you have to adjust your animation loop since we can’t use our well known window.requestAnimationFrame() function. For VR projects we use setAnimationLoop. The minimal code looks like this:
renderer.setAnimationLoop( function () {
renderer.render( scene, camera );
} );
It’s not clear how this can be done in react-three-fiber. Any advice?
Thanks!
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:17 (11 by maintainers)
Top Results From Across the Web
How can react-three-fiber be used with vr? · Issue #80
requestAnimationFrame() function. For VR projects we use setAnimationLoop. The minimal code looks like this: renderer.setAnimationLoop( function ...
Read more >Enabling VR | React Three Fiber
Enabling VR. Supplying the vr flag enables Three's VR mode and switches the render-loop to gl.setAnimationLoop as described in Three's docs.
Read more >Write your first VR web application using React and WebXR
With react-three-fiber we can use THREE.js primitives like ambientLight the same way we can use DOM primitives like div or image .
Read more >react-three/xr examples
Learn how to use @react-three/xr by viewing and forking example apps that make use of @react-three/xr on CodeSandbox. ; particles ; neefrehman/generative ;...
Read more >Tutorial: Use react-three-fiber to render 3D in-browser visuals
What if I told you… that you too can learn to code in 3D objects in React that can wow customers? Learn the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@drcmda this is what we are working on built with react-three-fiber: https://youtu.be/70RNZHEc39Q
@setpixel @Toseben i have a draft, but don’t know how to test without equipment. No idea how to run it and the web gives conflicting info. The official threejs examples don’t have that split screen, some websites use StereoEffect, no idea what to do next.
If you want to try, it looks like this currently:
The exports loader thing is b/c webvr.js isn’t a module, but it could also be copied and exported properly. Other than that, supplying the “vr” attrib is enough to switch gl into vr mode and it’s using setAnimation instead of raf.
It’s out as 2.1.0-beta.0
Here’s a live demo: https://codesandbox.io/s/72225y7jmx