Three.js viewer with optional VR — model: A.glb
This page uses Three.js and WebXR to display a 3D model (A.glb) in the browser, with support for virtual reality (VR). Below is a simple explanation of how the code works and what each part does, so you can learn how to build your own 3D and VR projects.
GLTFLoader loads A.glb (place it next to this HTML file). The model is scaled and centred, then added to the scene.OrbitControls).XRButton adds “Enter VR” when supported.Try it out! Replace A.glb with your own model. Use the browser console (F12) if loading fails. See the Three.js documentation for more.