diff --git a/input-profiles.html b/input-profiles.html index 44777ea2..53e126a4 100644 --- a/input-profiles.html +++ b/input-profiles.html @@ -178,7 +178,7 @@ // here to handle the animation, but this sample will skip that // and only display a static mesh for simplicity. - scene.inputRenderer.setControllerMesh(new Gltf2Node({url: assetPath}), inputSource.handedness); + scene.inputRenderer.setControllerMesh(new Gltf2Node({url: assetPath}), inputSource.handedness, inputSource.profiles[0]); }); } } @@ -213,7 +213,7 @@ if (inputSource.gripSpace) { let gripPose = frame.getPose(inputSource.gripSpace, refSpace); if (gripPose) { - scene.inputRenderer.addController(gripPose.transform.matrix, inputSource.handedness); + scene.inputRenderer.addController(gripPose.transform.matrix, inputSource.handedness, inputSource.profiles[0]); } } diff --git a/input-tracking.html b/input-tracking.html index 4b41838d..1677c967 100644 --- a/input-tracking.html +++ b/input-tracking.html @@ -204,7 +204,7 @@ if (gripPose) { // If we have a grip pose use it to render a mesh showing the // position of the controller. - scene.inputRenderer.addController(gripPose.transform.matrix, inputSource.handedness); + scene.inputRenderer.addController(gripPose.transform.matrix, inputSource.handedness, inputSource.profiles[0]); } } diff --git a/js/render/nodes/input-renderer.js b/js/render/nodes/input-renderer.js index d8e90b5a..79030874 100644 --- a/js/render/nodes/input-renderer.js +++ b/js/render/nodes/input-renderer.js @@ -246,7 +246,7 @@ export class InputRenderer extends Node { for (let inputSource of event.added) { if (inputSource.targetRayMode == 'tracked-pointer') { fetchProfile(inputSource, DEFAULT_PROFILES_PATH).then(({profile, assetPath}) => { - this.setControllerMesh(new Gltf2Node({url: assetPath}), inputSource.handedness); + this.setControllerMesh(new Gltf2Node({url: assetPath}), inputSource.handedness, inputSource.profiles[0]); }); } } @@ -262,19 +262,19 @@ export class InputRenderer extends Node { }); } - setControllerMesh(controllerNode, handedness = 'right') { + setControllerMesh(controllerNode, handedness = 'right', profile = '') { if (!this._controllers) { this._controllers = {}; } - this._controllers[handedness] = { nodes: [controllerNode], activeCount: 0 }; + this._controllers[profile + "_" + handedness] = { nodes: [controllerNode], activeCount: 0 }; controllerNode.visible = false; // FIXME: Temporary fix to initialize for cloning. this.addNode(controllerNode); } - addController(gripMatrix, handedness = 'right') { + addController(gripMatrix, handedness = 'right', profile = '') { if (!this._controllers || this._blurred) { return; } - let controller = this._controllers[handedness]; + let controller = this._controllers[profile + "_" + handedness]; if (!controller) { return; } diff --git a/js/render/scenes/scene.js b/js/render/scenes/scene.js index 21466bb2..afc94773 100644 --- a/js/render/scenes/scene.js +++ b/js/render/scenes/scene.js @@ -140,7 +140,7 @@ export class Scene extends Node { // Any time that we have a grip matrix, we'll render a controller. if (gripPose) { - this.inputRenderer.addController(gripPose.transform.matrix, inputSource.handedness); + this.inputRenderer.addController(gripPose.transform.matrix, inputSource.handedness, inputSource.profiles[0]); } } diff --git a/tests/pointer-painter.html b/tests/pointer-painter.html index 5c1487ba..4cf43260 100644 --- a/tests/pointer-painter.html +++ b/tests/pointer-painter.html @@ -112,7 +112,7 @@ if (inputSource.gripSpace) { let gripPose = frame.getPose(inputSource.gripSpace, refSpace); if (gripPose) { - this.scene.inputRenderer.addController(gripPose.transform.matrix, inputSource.handedness); + this.scene.inputRenderer.addController(gripPose.transform.matrix, inputSource.handedness, inputSource.profiles[0]); } } }