From f7c85552f7e10797766a89f03755352f47aad55d Mon Sep 17 00:00:00 2001
From: joni <johnfshaughnessy@gmail.com>
Date: Wed, 18 Jul 2018 14:25:31 -0700
Subject: [PATCH] Fix getting the box by calling updateMatrixWorld AGAIN. :(

---
 src/components/position-at-box-shape-border.js | 2 +-
 src/utils/auto-box-collider.js                 | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/components/position-at-box-shape-border.js b/src/components/position-at-box-shape-border.js
index 4378d15c6..1a63c1b46 100644
--- a/src/components/position-at-box-shape-border.js
+++ b/src/components/position-at-box-shape-border.js
@@ -58,11 +58,11 @@ AFRAME.registerComponent("position-at-box-shape-border", {
       }
       if (!this.halfExtents || this.mesh !== this.el.getObject3D("mesh") || this.shape !== this.el.components.shape) {
         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 = new THREE.Vector3().copy(this.shape.data.halfExtents);
         } else {
+          const box = getBox(this.el, this.mesh);
           this.halfExtents = box.min
             .clone()
             .negate()
diff --git a/src/utils/auto-box-collider.js b/src/utils/auto-box-collider.js
index 12fccbb4d..dcabfb3c0 100644
--- a/src/utils/auto-box-collider.js
+++ b/src/utils/auto-box-collider.js
@@ -7,6 +7,7 @@ export function getBox(entity, boxRoot) {
   box.expandByObject = expandByObject;
   box.setFromObject(boxRoot);
   entity.object3D.rotation.copy(rotation);
+  entity.object3D.updateMatrixWorld(true);
   return box;
 }
 
-- 
GitLab