Skip to content

Commit

Permalink
fix networked-hand-controls issues with aframe-v1.5.0 (#451)
Browse files Browse the repository at this point in the history
  • Loading branch information
bruce90j committed Feb 4, 2024
1 parent 0f84523 commit 5ccb8af
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/components/networked-hand-controls.js
Expand Up @@ -203,7 +203,6 @@ AFRAME.registerComponent('networked-hand-controls', {
this.loader = new THREE.GLTFLoader();
this.loader.setCrossOrigin('anonymous');
const handmodelUrl = this.MODEL_BASE + this.MODEL_NAMES[this.data.handModelStyle + this.data.hand.charAt(0).toUpperCase() + this.data.hand.slice(1)];

this.loader.load(this.data.customHandModelURL || handmodelUrl, gltf => {
const newMesh = gltf.scene.children[0];
const handModelOrientation = this.data.hand === 'left' ? Math.PI / 2 : -Math.PI / 2;
Expand All @@ -212,13 +211,17 @@ AFRAME.registerComponent('networked-hand-controls', {
this.clips = gltf.animations;
this.clips.forEach((clip) => {
this.clipNameToClip[clip.name] = clip;
})
})

this.el.setObject3D(this.str.mesh, newMesh);

const handMaterial = newMesh.children[1].material;
handMaterial.color = new THREE.Color(this.data.color);
this.rendererSystem.applyColorCorrection(handMaterial.color);
const handColor = this.data.color;
newMesh.traverse(function (object) {
if (!object.isMesh) {
return;
}
object.material.color = new THREE.Color(handColor);
});
newMesh.position.set(0, 0, 0);
newMesh.rotation.set(0, 0, handModelOrientation);
});
Expand All @@ -243,8 +246,6 @@ AFRAME.registerComponent('networked-hand-controls', {
'valve-index-controls',
// some older models that it doesn't hurt to include:
'oculus-go-controls',
'gearvr-controls',
'daydream-controls',
'vive-focus-controls',
],

Expand Down

0 comments on commit 5ccb8af

Please sign in to comment.