Skip to content

Commit 12d550c

Browse files
committed
Setup wristObject in init. Fix problem when adding children entities to the hand before the hand model had loaded
1 parent 70f0899 commit 12d550c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/components/hand-tracking-controls.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,9 @@ module.exports.Component = registerComponent('hand-tracking-controls', {
8585
sceneEl.setAttribute('webxr', webxrData);
8686
}
8787

88+
this.wristObject3D = new THREE.Object3D();
89+
this.el.sceneEl.object3D.add(this.wristObject3D);
90+
8891
this.onModelLoaded = this.onModelLoaded.bind(this);
8992
this.onChildAttached = this.onChildAttached.bind(this);
9093
this.jointEls = [];
@@ -378,12 +381,10 @@ module.exports.Component = registerComponent('hand-tracking-controls', {
378381

379382
setupChildrenEntities: function () {
380383
var childrenEls = this.el.children;
381-
this.wristObject3D = new THREE.Object3D();
382384
for (var i = 0; i < childrenEls.length; ++i) {
383385
if (!(childrenEls[i] instanceof AEntity)) { continue; }
384386
this.addChildEntity(childrenEls[i]);
385387
}
386-
this.el.sceneEl.object3D.add(this.wristObject3D);
387388
},
388389

389390
addChildEntity: function (childEl) {

0 commit comments

Comments
 (0)