implement rotation reset via an unrotate stack
This commit is contained in:
parent
a9b04ad26f
commit
8486454d1d
4 changed files with 11 additions and 7 deletions
|
|
@ -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() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue