Skip to content

Commit

Permalink
Don't update anchor pose if the anchor not tracked by the hit test co…
Browse files Browse the repository at this point in the history
…mponent (fix #5314)
  • Loading branch information
dmarcos committed Nov 16, 2023
1 parent 4846ff4 commit abab0a7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/components/scene/ar-hit-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
});
Expand Down Expand Up @@ -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) {
Expand All @@ -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({
Expand All @@ -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;
Expand Down

0 comments on commit abab0a7

Please sign in to comment.