JSFiddle - React, Tailwind, and code Playground
HTML
<!--
From webxr_vr_dragging example https://threejs.org/examples/#webxr_vr_dragging
Modified example to include a camera dolly that moves around using touchControllers while within webXR and provides haptic feedback
by Jason Buchheim
https://3d-360.com
https://odysseyexpeditions.com
Further modified by Mike Young to...
* disable out haptic feedback
* tweak controls and movement a bit
* add a bouncing ball that's grippable and throwable
* implement a simple game loop to seperate logic from rendering, from https://isaacsukin.com/news/2015/01/detailed-explanation-javascript-game-loops-and-timing
* add a text HUD for debugging purposes
* calculate and display FPS on the text HUD
-->
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
</head>
<body>
<script async src="https://unpkg.com/es-module-shims@1.3.6/dist/es-module-shims.js"></script>
<script type="importmap">
{
"imports": {
"three": "https://unpkg.com/three@0.138.3/build/three.module.js"
}
}
</script>
<script type="module">
//// From webxr_vr_dragging example https://threejs.org/examples/#webxr_vr_dragging
import * as THREE from "https://cdn.jsdelivr.net/npm/three@0.119.1/build/three.module.min.js";
import { OrbitControls } from "https://cdn.jsdelivr.net/npm/three@0.119.1/examples/jsm/controls/OrbitControls.min.js";
import { VRButton } from "https://cdn.jsdelivr.net/npm/three@0.119.1/examples/jsm/webxr/VRButton.min.js";
import { XRControllerModelFactory } from "https://cdn.jsdelivr.net/npm/three@0.119.1/examples/jsm/webxr/XRControllerModelFactory.min.js";
var container;
var camera, scene, renderer;
var controller1, controller2;
var controllerGrip1, controllerGrip2;
var raycaster,
intersected = [];
var tempMatrix = new THREE.Matrix4();
var controls, group;
var camPosition = new THREE.Vector3();
var camRotation = new THREE.Quaternion();
var camScale = new THREE.Vector3();
var dolPosition = new THREE.Vector3();
var dolRotation = new...