Skip to content

Commit

Permalink
Apply a PI/4 offset on the hands models when using pico4 controller
Browse files Browse the repository at this point in the history
  • Loading branch information
Elettrotecnica committed Jun 11, 2024
1 parent 928c7fa commit 1f98ee6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/components/hand-controls.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,16 @@ module.exports.Component = registerComponent('hand-controls', {
el.setAttribute('pico-controls', controlConfiguration);
el.setAttribute('windows-motion-controls', controlConfiguration);
el.setAttribute('hp-mixed-reality-controls', controlConfiguration);

// Pico4, at least on Wolvic, needs a different rotation
// offset for the hand model. Pico Browser claims to use
// oculus controllers instead; will load oculus-touch-controls
// and does not require this adjustment.
el.addEventListener('controllerconnected', function (evt) {
if (evt.detail.name === 'pico-controls') {
mesh.rotation.x += Math.PI / 4;
}
}, {once: true});
});
}
},
Expand Down
1 change: 1 addition & 0 deletions src/components/pico-controls.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ module.exports.Component = registerComponent('pico-controls', {
controller: this.controllerIndex,
orientationOffset: data.orientationOffset
});

// Load model.
if (!this.data.model) { return; }
this.el.setAttribute('gltf-model', PICO_MODEL_GLB_BASE_URL + this.data.hand + '.glb');
Expand Down

0 comments on commit 1f98ee6

Please sign in to comment.