Skip to content

Commit bcc4bc2

Browse files
dmarcosgydence
authored andcommitted
Don't update anchor pose if the anchor not tracked by the hit test component (fix #5314)
1 parent 55846a4 commit bcc4bc2

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/components/scene/ar-hit-test.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,9 +196,9 @@ HitTest.updateAnchorPoses = function (frame, refSpace) {
196196

197197
if (anchorPose) {
198198
object3DOptions = HitTest.prototype.anchorToObject3D.get(anchor);
199+
if (!object3DOptions) { return; }
199200
offset = object3DOptions.offset;
200201
object3D = object3DOptions.object3D;
201-
202202
applyPose(anchorPose, object3D, offset);
203203
}
204204
});
@@ -365,6 +365,7 @@ module.exports.Component = register('ar-hit-test', {
365365
this.update = this.update.bind(this);
366366
this.makeBBox();
367367
},
368+
368369
update: function () {
369370
// If it is disabled it's cleaned up
370371
if (this.data.enabled === false) {
@@ -384,6 +385,7 @@ module.exports.Component = register('ar-hit-test', {
384385
}
385386
this.bboxNeedsUpdate = true;
386387
},
388+
387389
makeBBox: function () {
388390
var geometry = new THREE.PlaneGeometry(1, 1);
389391
var material = new THREE.MeshBasicMaterial({
@@ -397,6 +399,7 @@ module.exports.Component = register('ar-hit-test', {
397399
this.el.setObject3D('ar-hit-test', this.bboxMesh);
398400
this.bboxMesh.visible = false;
399401
},
402+
400403
updateFootprint: function () {
401404
var tempImageData;
402405
var renderer = this.el.sceneEl.renderer;

0 commit comments

Comments
 (0)