Skip to content

Commit

Permalink
Removed repeated code
Browse files Browse the repository at this point in the history
Call updateModelMaterial to avoid duplicated code.
  • Loading branch information
ehammons11 committed Jan 17, 2024
1 parent 3cf1431 commit c15f23c
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions src/components/hand-tracking-controls.js
Original file line number Diff line number Diff line change
Expand Up @@ -361,15 +361,12 @@ module.exports.Component = registerComponent('hand-tracking-controls', {
primitive: 'sphere',
radius: 1.0
});
jointEl.setAttribute('material', {
color: this.data.modelColor,
transparent: !(this.data.modelOpacity === 1.0),
opacity: this.data.modelOpacity
});
jointEl.setAttribute('material', {color: this.data.modelColor});
jointEl.object3D.visible = false;
this.el.appendChild(jointEl);
this.jointEls.push(jointEl);
}
this.updateModelMaterial();
},

initMeshHandModel: function () {
Expand All @@ -386,11 +383,8 @@ module.exports.Component = registerComponent('hand-tracking-controls', {
mesh.position.set(0, 0, 0);
mesh.rotation.set(0, 0, 0);
skinnedMesh.frustumCulled = false;
skinnedMesh.material = new THREE.MeshStandardMaterial( {
color: this.data.modelColor,
transparent: !(this.data.modelOpacity === 1.0),
opacity: this.data.modelOpacity
});
skinnedMesh.material = new THREE.MeshStandardMaterial({color: this.data.modelColor});
this.updateModelMaterial();
this.setupChildrenEntities();
this.el.setObject3D('mesh', mesh);
},
Expand Down

0 comments on commit c15f23c

Please sign in to comment.