correct scale calculation

This commit is contained in:
Stewart Allen 2022-01-10 18:10:57 -05:00
commit 1cdfcab55f
2 changed files with 6 additions and 5 deletions

View file

@ -139,7 +139,7 @@ let selection = {
scale(dx = 0, dy = 0, dz = 0) { scale(dx = 0, dy = 0, dz = 0) {
for (let s of selected) { for (let s of selected) {
let { x, y, z } = s.scale(); let { x, y, z } = s.scale();
s.scale(x + dx, y + dy, z + dz); s.scale(x * dx, y * dy, z * dz);
} }
return selection; return selection;
}, },
@ -423,9 +423,11 @@ let util = mesh.util = {
if (!cached || cached.bkey !== bkey) { if (!cached || cached.bkey !== bkey) {
let position = geometry.attributes.position.clone(); let position = geometry.attributes.position.clone();
position.applyMatrix4(new THREE.Matrix4().extractRotation(matrix)); position.applyMatrix4(new THREE.Matrix4().extractRotation(matrix));
cached = boundsCache[object.id] = { bkey, let bounds = new THREE.Box3().setFromBufferAttribute(position);
bounds: new THREE.Box3().setFromBufferAttribute(position) // let scale = new THREE.Vector3().setFromMatrixScale(matrix);
}; // bounds.min.multiply(scale);
// bounds.max.multiply(scale);
cached = boundsCache[object.id] = { bkey, bounds };
} }
let bt = cached.bounds.clone(); let bt = cached.bounds.clone();
let m4 = new THREE.Matrix4(); let m4 = new THREE.Matrix4();

View file

@ -96,7 +96,6 @@ mesh.object = class MeshObject {
} }
scale.set(...arguments); scale.set(...arguments);
this.matrixChanged(); this.matrixChanged();
let [ x, y, z ] = arguments;
} }
rotate(x = 0, y = 0, z = 0) { rotate(x = 0, y = 0, z = 0) {