mirror of
https://github.com/Doodle3D/Doodle3D-Slicer.git
synced 2024-11-22 13:37:58 +01:00
simplify place on ground
This commit is contained in:
parent
2c2b547ea2
commit
a5547ac070
@ -3,9 +3,7 @@ import 'three/examples/js/controls/EditorControls';
|
|||||||
import 'three/examples/js/controls/TransformControls';
|
import 'three/examples/js/controls/TransformControls';
|
||||||
|
|
||||||
export function placeOnGround(mesh) {
|
export function placeOnGround(mesh) {
|
||||||
const boundingBox = new THREE.Box3();
|
const boundingBox = new THREE.Box3().setFromObject(mesh);
|
||||||
const vertices = mesh.geometry.vertices.map(vertex => vertex.clone().applyMatrix4(mesh.matrix));
|
|
||||||
boundingBox.setFromPoints(vertices);
|
|
||||||
|
|
||||||
mesh.position.y -= boundingBox.min.y;
|
mesh.position.y -= boundingBox.min.y;
|
||||||
mesh.updateMatrix();
|
mesh.updateMatrix();
|
||||||
|
Loading…
Reference in New Issue
Block a user