feat/model-viewer: work in progress [might break]

This commit is contained in:
Leon van Kammen 2024-06-12 10:34:11 +00:00
parent 0649163c41
commit eb66d0a496
1 changed files with 15 additions and 3 deletions

View File

@ -18,8 +18,8 @@
<script type="importmap">
{
"imports": {
"three": "https://unpkg.com/three@0.151.3/build/three.module.js",
"three/addons/": "https://unpkg.com/three@0.151.3/examples/jsm/"
"three": "https://unpkg.com/three@0.165.0/build/three.module.js",
"three/addons/": "https://unpkg.com/three@0.165.0/examples/jsm/"
}
}
</script>
@ -32,7 +32,6 @@
import { RGBELoader } from 'three/addons/loaders/RGBELoader.js';
import { Lensflare, LensflareElement } from 'three/addons/objects/Lensflare.js';
import { BoxLineGeometry } from 'three/addons/geometries/BoxLineGeometry.js';
import { Reflector } from 'three/addons/objects/Reflector.js';
import { VRButton } from 'three/addons/webxr/VRButton.js';
import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js';
import { FBXLoader } from 'three/addons/loaders/FBXLoader.js';
@ -41,6 +40,7 @@
import { HTMLMesh } from 'three/addons/interactive/HTMLMesh.js';
import { InteractiveGroup } from 'three/addons/interactive/InteractiveGroup.js';
import { XRControllerModelFactory } from 'three/addons/webxr/XRControllerModelFactory.js';
import { OculusHandModel } from 'three/addons/webxr/OculusHandModel.js';
import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
import { GUI } from 'three/addons/libs/lil-gui.module.min.js';
import Stats from 'three/addons/libs/stats.module.js';
@ -160,10 +160,22 @@
controllerGrip1.add( controllerModelFactory.createControllerModel( controllerGrip1 ) );
cameraRig.add( controllerGrip1 );
// hand1
const hand1 = renderer.xr.getHand( 0 );
const handModel1 = new OculusHandModel( hand1 );
hand1.add( handModel1 );
cameraRig.add( hand1 );
const controllerGrip2 = renderer.xr.getControllerGrip( 1 );
controllerGrip2.add( controllerModelFactory.createControllerModel( controllerGrip2 ) );
cameraRig.add( controllerGrip2 );
// hand2
const hand2 = renderer.xr.getHand( 1 );
const handModel2 = new OculusHandModel( hand2 );
hand2.add( handModel2 );
cameraRig.add( hand2 );
// Add stats.js
stats = new Stats();
stats.dom.style.width = '80px';