ThreeJS Scene To VR

Hi, I want to transform my scene into a VR scene, is the renderer.XR.enabled = true enough?

1 Like

There are several things that I do when converting to a VR scene.

  1. import three/examples/jsm/webxr/VRButton
  2. renderer.xr.enabled = true
  3. document.body.appendChild(VRButton.createButton(renderer))
  4. Use the renderer.setAnimationLoop() function instead of requestAnimationFrame

See simple example and source code here

https://sbcode.net/threejs/random-puncher/

2 Likes

Thanks you, it worked :slight_smile: