begin vertex / line / face selector

This commit is contained in:
Stewart Allen 2022-01-12 23:02:08 -05:00
commit dd38b0f128
7 changed files with 77 additions and 48 deletions

View file

@ -17,18 +17,19 @@ gapp.register("mesh.group", [
let mesh = self.mesh = self.mesh || {};
if (mesh.group) return;
let { Quaternion, Group, Vector3 } = THREE;
let broker = gapp.broker;
let call = broker.send;
let space = moto.Space;
let worker = moto.client.fn;
let lookUp = new Vector3(0,0,-1);
mesh.group = class MeshGroup extends mesh.object {
// @param group {MeshModel[]}
constructor(models = [], id, name) {
super(id);
this.group3 = new THREE.Group();
this.group3 = new Group();
this.models = [];
this.name = name;
for (let model of models) {
@ -88,6 +89,13 @@ mesh.group = class MeshGroup extends mesh.object {
return this;
}
// rotate model so face normal points toward floor
faceDown(normal) {
let q = new Quaternion().setFromUnitVectors(normal, lookUp);
this.qrotation(q);
this.floor();
}
promote() {
return this.centerModels().centerXY().floor();
}