|
@@ -4,15 +4,20 @@ const DEFAULT_HAND_PROFILE_PATH = 'https://cdn.jsdelivr.net/npm/@webxr-input-pro
|
|
|
|
|
|
class XRHandMeshModel {
|
|
|
|
|
|
- constructor( handModel, controller, path, handedness ) {
|
|
|
+ constructor( handModel, controller, path, handedness, loader = null ) {
|
|
|
|
|
|
this.controller = controller;
|
|
|
this.handModel = handModel;
|
|
|
|
|
|
this.bones = [];
|
|
|
|
|
|
- const loader = new GLTFLoader();
|
|
|
- loader.setPath( path || DEFAULT_HAND_PROFILE_PATH );
|
|
|
+ if ( loader === null ) {
|
|
|
+
|
|
|
+ loader = new GLTFLoader();
|
|
|
+ loader.setPath( path || DEFAULT_HAND_PROFILE_PATH );
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
loader.load( `${handedness}.glb`, gltf => {
|
|
|
|
|
|
const object = gltf.scene.children[ 0 ];
|