resolve centering model vs group so rotation works
This commit is contained in:
parent
45d59d0bbc
commit
9bb758f323
3 changed files with 24 additions and 5 deletions
|
|
@ -18,15 +18,25 @@ if (mesh.group) return;
|
|||
mesh.group = class MeshGroup extends mesh.object {
|
||||
|
||||
// @param group {mesh.model[]}
|
||||
constructor(models) {
|
||||
constructor(models = []) {
|
||||
super();
|
||||
this.group = new THREE.Group();
|
||||
this.models = [];
|
||||
for (let model of (models || [])) {
|
||||
for (let model of models) {
|
||||
this.add(model);
|
||||
}
|
||||
}
|
||||
|
||||
// center objects to group bounds
|
||||
// dependent on first being added to world/scene
|
||||
centerModels() {
|
||||
let bounds = this.bounds();
|
||||
for (let model of this.models) {
|
||||
model.center(bounds);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
object() {
|
||||
return this.group;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue