From e47e8886158c489ef17175e7f58b45d7d9ef4edf Mon Sep 17 00:00:00 2001 From: joni <johnfshaughnessy@gmail.com> Date: Tue, 17 Jul 2018 18:22:51 -0700 Subject: [PATCH] Fix auto box collider util --- src/components/position-at-box-shape-border.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/components/position-at-box-shape-border.js b/src/components/position-at-box-shape-border.js index 65b3d32d2..4378d15c6 100644 --- a/src/components/position-at-box-shape-border.js +++ b/src/components/position-at-box-shape-border.js @@ -53,12 +53,15 @@ AFRAME.registerComponent("position-at-box-shape-border", { this.target = this.el.querySelector(this.data.target).object3D; if (!this.target) return; } + if (!this.el.getObject3D("mesh")) { + return; + } if (!this.halfExtents || this.mesh !== this.el.getObject3D("mesh") || this.shape !== this.el.components.shape) { - this.mesh = this.el.getObject3D("mesh"); //... + this.mesh = this.el.getObject3D("mesh"); const box = getBox(this.el, this.mesh); if (this.el.components.shape) { this.shape = this.el.components.shape; - this.halfExtents = this.shape.data.halfExtents.clone(); + this.halfExtents = new THREE.Vector3().copy(this.shape.data.halfExtents); } else { this.halfExtents = box.min .clone() -- GitLab