Skip to content

Commit d4c1b87

Browse files
A more robust fix that doesn't depend on hardcoded indices (#5340)
* A more robust fix that doesn't depend on hardcoded indices * ES6 not allowed in A-Frame. * No single letter variables * nit - early return --------- Co-authored-by: Diego Marcos <diego.marcos@gmail.com>
1 parent d15bf5a commit d4c1b87

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/components/hand-controls.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -204,9 +204,10 @@ module.exports.Component = registerComponent('hand-controls', {
204204
mesh.mixer = new THREE.AnimationMixer(mesh);
205205
self.clips = gltf.animations;
206206
el.setObject3D('mesh', mesh);
207-
208-
var handMaterial = mesh.children[0].material;
209-
handMaterial.color = new THREE.Color(handColor);
207+
mesh.traverse(function (object) {
208+
if (!object.isMesh) { return; }
209+
object.material.color = new THREE.Color(handColor);
210+
});
210211
mesh.position.set(0, 0, 0);
211212
mesh.rotation.set(handModelOrientationX, 0, handModelOrientationZ);
212213
el.setAttribute('magicleap-controls', controlConfiguration);

0 commit comments

Comments
 (0)