Skip to content
Snippets Groups Projects
Commit d2ceef5b authored by netpro2k's avatar netpro2k
Browse files

small optimization to destroy-at-extreme-distance

parent 33b75012
No related branches found
No related tags found
No related merge requests found
......@@ -13,6 +13,9 @@ AFRAME.registerComponent("destroy-at-extreme-distances", {
return function() {
const { xMin, xMax, yMin, yMax, zMin, zMax } = this.data;
this.el.object3D.getWorldPosition(pos);
this.el.parentNode === this.el.sceneEl
? pos.copy(this.el.object3D.position)
: this.el.object3D.getWorldPosition(pos);
if (pos.x < xMin || pos.x > xMax || pos.y < yMin || pos.y > yMax || pos.z < zMin || pos.z > zMax) {
this.el.parentNode.removeChild(this.el);
}
......
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