implement rotation reset via an unrotate stack

This commit is contained in:
Stewart Allen 2020-06-14 10:00:05 -04:00
commit 8486454d1d
4 changed files with 11 additions and 7 deletions

View file

@ -112,7 +112,7 @@
if (groups.indexOf(this.group) < 0) {
groups.push(this.group);
}
this.roto = new THREE.Matrix4();
this.roto = [];
this.mesh = null;
this.points = null;
// todo resolve use of this vs. mesh.bounds
@ -549,8 +549,8 @@
} else {
m4 = m4.makeRotationFromQuaternion(x);
}
this.roto.multiply(m4);
this.mesh.geometry.applyMatrix4(new THREE.Matrix4().getInverse(m4));
this.roto.push(m4);
this.mesh.geometry.applyMatrix4(m4);
if (!temp && euler) {
let rot = this.track.rot;
rot.x += (x || 0);
@ -560,7 +560,11 @@
};
PRO.unrotate = function() {
this.mesh.geometry.applyMatrix4(this.roto);
this.roto.reverse().forEach(m => {
this.mesh.geometry.applyMatrix4(new THREE.Matrix4().getInverse(m));
});
this.roto = [];
this.center();
};
PRO.mirror = function() {