Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initialize hand opacity #5433

Merged
merged 10 commits into from
Jan 17, 2024
8 changes: 5 additions & 3 deletions src/components/hand-tracking-controls.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,14 +129,14 @@ module.exports.Component = registerComponent('hand-tracking-controls', {
var transparent = !(this.data.modelOpacity === 1.0);
if (skinnedMesh) {
this.skinnedMesh.material.color.set(this.data.modelColor);
this.skinnedMesh.material.transparent.set(transparent);
this.skinnedMesh.material.transparent = transparent;
this.skinnedMesh.material.opacity.set(this.data.modelOpacity);
}

for (var i = 0; i < jointEls.length; i++) {
jointEls[i].setAttribute('material', 'color', this.data.modelColor);
jointEls[i].setAttribute('material', 'transparent', transparent);
jointEls[i].setAttribute('material', 'opacity', this.data.modelOpacity);
jointEls[i].setAttribute('material', 'transparent', transparent);
jointEls[i].setAttribute('material', 'opacity', this.data.modelOpacity);
}
},

Expand Down Expand Up @@ -366,6 +366,7 @@ module.exports.Component = registerComponent('hand-tracking-controls', {
this.el.appendChild(jointEl);
this.jointEls.push(jointEl);
}
this.updateModelMaterial();
},

initMeshHandModel: function () {
Expand All @@ -383,6 +384,7 @@ module.exports.Component = registerComponent('hand-tracking-controls', {
mesh.rotation.set(0, 0, 0);
skinnedMesh.frustumCulled = false;
skinnedMesh.material = new THREE.MeshStandardMaterial({color: this.data.modelColor});
this.updateModelMaterial();
this.setupChildrenEntities();
this.el.setObject3D('mesh', mesh);
},
Expand Down
Loading