Skip to content

Commit

Permalink
PR feedback
Browse files Browse the repository at this point in the history
Previous attempt didn't preserve this in forEach() callback.  This version should work better (while still only using ES5 constructs).
  • Loading branch information
diarmidmackenzie committed Nov 5, 2023
1 parent efb41f8 commit bc3e20a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/components/hand-tracking-controls.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,12 +167,13 @@ module.exports.Component = registerComponent('hand-tracking-controls', {
return function () {
var jointPoses = this.jointPoses;
var controller = this.el.components['tracked-controls'] && this.el.components['tracked-controls'].controller;
var i = 0;

if (!controller || !this.mesh) { return; }
this.mesh.visible = false;
if (!this.hasPoses) { return; }
controller.hand.values().forEach(function (inputjoint) {
var inputjoints = controller.hand.values();
for (var i = 0; i < inputjoints.length; i++) {
var inputjoint = inputjoints[i];
var bone = this.getBone(inputjoint.jointName);
if (bone != null) {
this.mesh.visible = true;
Expand All @@ -181,7 +182,7 @@ module.exports.Component = registerComponent('hand-tracking-controls', {
bone.quaternion.setFromRotationMatrix(jointPose);
}
i++;
});
}
};
})(),

Expand Down

0 comments on commit bc3e20a

Please sign in to comment.