From abab0a7d293643f91a714e5d942cfa9cfe4d0885 Mon Sep 17 00:00:00 2001 From: Diego Marcos Segura Date: Thu, 16 Nov 2023 14:20:14 -0800 Subject: [PATCH] Don't update anchor pose if the anchor not tracked by the hit test component (fix #5314) --- src/components/scene/ar-hit-test.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/components/scene/ar-hit-test.js b/src/components/scene/ar-hit-test.js index 2879ffbdc83..039e80a740a 100644 --- a/src/components/scene/ar-hit-test.js +++ b/src/components/scene/ar-hit-test.js @@ -196,9 +196,9 @@ HitTest.updateAnchorPoses = function (frame, refSpace) { if (anchorPose) { object3DOptions = HitTest.prototype.anchorToObject3D.get(anchor); + if (!object3DOptions) { return; } offset = object3DOptions.offset; object3D = object3DOptions.object3D; - applyPose(anchorPose, object3D, offset); } }); @@ -365,6 +365,7 @@ module.exports.Component = register('ar-hit-test', { this.update = this.update.bind(this); this.makeBBox(); }, + update: function () { // If it is disabled it's cleaned up if (this.data.enabled === false) { @@ -384,6 +385,7 @@ module.exports.Component = register('ar-hit-test', { } this.bboxNeedsUpdate = true; }, + makeBBox: function () { var geometry = new THREE.PlaneGeometry(1, 1); var material = new THREE.MeshBasicMaterial({ @@ -397,6 +399,7 @@ module.exports.Component = register('ar-hit-test', { this.el.setObject3D('ar-hit-test', this.bboxMesh); this.bboxMesh.visible = false; }, + updateFootprint: function () { var tempImageData; var renderer = this.el.sceneEl.renderer;