fix mesh rotation compensation

This commit is contained in:
Stewart Allen 2022-11-01 10:12:22 -04:00
commit d54b7590c4
2 changed files with 8 additions and 7 deletions

View file

@ -1370,6 +1370,7 @@ CAM.init = function(kiri, api) {
api.event.on('tool.mesh.face-normal', normal => {
poppedRec.degrees = (Math.atan2(normal.y, normal.z) * (180 / Math.PI)).round(2);
poppedRec.absolute = true;
func.opRender();
});
createPopOp('index', {

View file

@ -465,7 +465,7 @@ class Widget {
setAxisIndex(deg) {
let rad = deg * (Math.PI / 180);
this.track.indexRad = rad;
this.mesh.rotation.x = rad;
this.mesh.rotation.x = -rad;
this.setTopZ(this.track.top);
}
@ -488,16 +488,16 @@ class Widget {
track.tzoff = mbz - z;
if (track.indexed) {
let rad = track.indexRad;
let mz = track.box.h / 2;
let dx = Math.cos(rad) * mz;
let dy = Math.sin(rad) * mz;
let mz = track.box.d / 2;
let dx = Math.sin(rad) * mz;
let dy = mz - Math.cos(rad) * mz;
track.delta = {
x: 0,
y: Math.sin(rad) * mz,
z: -(track.indexed / 2) + (mz - dx)
y: -dx,
z: -(track.indexed / 2) + dy
};
} else {
track.delta = { x:0, y:0, z:0};
track.delta = { x:0, y:0, z:0 };
this.mesh.rotation.x = 0;
}
this.modified |= (ltop !== z);