still chasing model rotataion / bounding box issues
This commit is contained in:
parent
1093a05f2d
commit
258f927228
2 changed files with 30 additions and 1 deletions
|
|
@ -53,6 +53,36 @@ mesh.model = class MeshModel extends mesh.object {
|
|||
return this.mesh;
|
||||
}
|
||||
|
||||
move(x = 0, y = 0, z = 0) {
|
||||
// doesn't fix bounds issue for some rotations. inspired by this threejs forum post:
|
||||
// https://discourse.threejs.org/t/bounding-box-bigger-than-concave-object-extrudegeometry/26073/2
|
||||
// this.mesh.applyMatrix4(new THREE.Matrix4().makeTranslation(x,y,z));
|
||||
let pos = this.position();
|
||||
pos.set(pos.x + x, pos.y + y, pos.z + z);
|
||||
this.updateBoundsBox();
|
||||
moto.Space.update();
|
||||
return this;
|
||||
}
|
||||
|
||||
rotate() {
|
||||
throw "model rotate() not allowed";
|
||||
}
|
||||
|
||||
rotation() {
|
||||
throw "model rotation() not allowed";
|
||||
}
|
||||
|
||||
qrotation() {
|
||||
throw "model qrotation() not allowed";
|
||||
}
|
||||
|
||||
position() {
|
||||
if (arguments.length) {
|
||||
throw "model position(...) not allowed";
|
||||
}
|
||||
return super.position(...arguments);
|
||||
}
|
||||
|
||||
sync() {
|
||||
moto.client.fn.model_sync({
|
||||
vertices: this.mesh.geometry.attributes.position.array,
|
||||
|
|
|
|||
|
|
@ -30,7 +30,6 @@ moto.worker.bind("model_sync", (data, send) => {
|
|||
geo.computeVertexNormals();
|
||||
let m4 = space_rotation.clone().multiply( new THREE.Matrix4().fromArray(matrix) );
|
||||
geo.applyMatrix4(m4);
|
||||
return send.done();
|
||||
// for debugging matrix ops
|
||||
send.done(geo.attributes.position.array);
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue