fix other random breakage / omissions

This commit is contained in:
Stewart Allen 2025-06-14 09:03:41 -04:00
commit f35e9dc46a
4 changed files with 115 additions and 30 deletions

View file

@ -223,10 +223,14 @@ class MeshModel extends meshObject {
// moves mesh object center to target
centerTo(to) {
this.log('model-centerto', to);
let pos = this.position();
let { mid } = this.bounds;
this.translate(to.x - mid.x, to.y - mid.y, to.z - mid.z);
this.position(pos.x, pos.y, pos.z);
let abs = this.world_bounds.mid;
this.translate(
-mid.x + (abs.x - to.x),
-mid.y + (abs.y - to.y),
-mid.z + (abs.z - to.z),
);
this.position(to.x, to.y, to.z);
return this;
}