From a5547ac0709783badb4299667d5fea58e402dda3 Mon Sep 17 00:00:00 2001 From: casperlamboo Date: Sun, 12 Nov 2017 01:51:41 +0100 Subject: [PATCH] simplify place on ground --- src/interface/utils.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/interface/utils.js b/src/interface/utils.js index beb59a6..25c645d 100644 --- a/src/interface/utils.js +++ b/src/interface/utils.js @@ -3,9 +3,7 @@ import 'three/examples/js/controls/EditorControls'; import 'three/examples/js/controls/TransformControls'; export function placeOnGround(mesh) { - const boundingBox = new THREE.Box3(); - const vertices = mesh.geometry.vertices.map(vertex => vertex.clone().applyMatrix4(mesh.matrix)); - boundingBox.setFromPoints(vertices); + const boundingBox = new THREE.Box3().setFromObject(mesh); mesh.position.y -= boundingBox.min.y; mesh.updateMatrix();