Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/components/hand-controls.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,15 +198,18 @@ module.exports.Component = registerComponent('hand-controls', {
var handmodelUrl = MODEL_URLS[handModelStyle + hand.charAt(0).toUpperCase() + hand.slice(1)];
this.loader.load(handmodelUrl, function (gltf) {
var mesh = gltf.scene.children[0];
var handModelOrientation = hand === 'left' ? Math.PI / 2 : -Math.PI / 2;
var handModelOrientationZ = hand === 'left' ? Math.PI / 2 : -Math.PI / 2;
// The WebXR standard defines the grip space such that a cylinder held in a closed hand points
// along the Z axis. The models currently have such a cylinder point along the X-Axis.
var handModelOrientationX = el.sceneEl.hasWebXR ? -Math.PI / 2 : 0;
mesh.mixer = new THREE.AnimationMixer(mesh);
self.clips = gltf.animations;
el.setObject3D('mesh', mesh);

var handMaterial = mesh.children[1].material;
handMaterial.color = new THREE.Color(handColor);
mesh.position.set(0, 0, 0);
mesh.rotation.set(0, 0, handModelOrientation);
mesh.rotation.set(handModelOrientationX, 0, handModelOrientationZ);
el.setAttribute('magicleap-controls', controlConfiguration);
el.setAttribute('vive-controls', controlConfiguration);
el.setAttribute('oculus-touch-controls', controlConfiguration);
Expand Down