Skip to content
Snippets Groups Projects
Commit f7c85552 authored by joni's avatar joni
Browse files

Fix getting the box by calling updateMatrixWorld AGAIN. :(

parent 5943bc41
No related branches found
No related tags found
No related merge requests found
......@@ -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()
......
......@@ -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;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment