Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/components/hand-tracking-controls.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Use `hand-tracking-controls` to integrate [hand tracked input][webxrhandinput] i
|----------------|----------------------------------------------------------------------------------------|---------------|
| hand | The hand that will be tracked (i.e., right, left). | left |
| modelColor | Color of hand material. | white |
| modelOpacity | Opacity of the hand material. | 1.0 |
| modelStyle | Mesh representing the hand or dots matching the joints | mesh

## Events
Expand Down
12 changes: 9 additions & 3 deletions src/components/hand-tracking-controls.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ module.exports.Component = registerComponent('hand-tracking-controls', {
schema: {
hand: {default: 'right', oneOf: ['left', 'right']},
modelStyle: {default: 'mesh', oneOf: ['dots', 'mesh']},
modelColor: {default: 'white'}
modelColor: {default: 'white'},
modelOpacity: {default: 1.0}
},

bindMethods: function () {
Expand Down Expand Up @@ -119,18 +120,23 @@ module.exports.Component = registerComponent('hand-tracking-controls', {
},

update: function () {
this.updateModelColor();
this.updateModelMaterial();
},

updateModelColor: function () {
updateModelMaterial: function () {
var jointEls = this.jointEls;
var skinnedMesh = this.skinnedMesh;
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.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);
}
},

Expand Down