diff --git a/src/components/position-at-box-shape-border.js b/src/components/position-at-box-shape-border.js index 4378d15c6bdb39c636231bbdb3937b79a13f4efa..1a63c1b468588e5396a97459a250f5e6d3c17693 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 12fccbb4d6341e02a4498079859519b9df60fc8f..dcabfb3c0b16c3df3301f98d71d9f28bf1ffc8b9 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; }