fix mesh rotation compensation
This commit is contained in:
parent
7b51b893d0
commit
d54b7590c4
2 changed files with 8 additions and 7 deletions
|
|
@ -1370,6 +1370,7 @@ CAM.init = function(kiri, api) {
|
||||||
api.event.on('tool.mesh.face-normal', normal => {
|
api.event.on('tool.mesh.face-normal', normal => {
|
||||||
poppedRec.degrees = (Math.atan2(normal.y, normal.z) * (180 / Math.PI)).round(2);
|
poppedRec.degrees = (Math.atan2(normal.y, normal.z) * (180 / Math.PI)).round(2);
|
||||||
poppedRec.absolute = true;
|
poppedRec.absolute = true;
|
||||||
|
func.opRender();
|
||||||
});
|
});
|
||||||
|
|
||||||
createPopOp('index', {
|
createPopOp('index', {
|
||||||
|
|
|
||||||
|
|
@ -465,7 +465,7 @@ class Widget {
|
||||||
setAxisIndex(deg) {
|
setAxisIndex(deg) {
|
||||||
let rad = deg * (Math.PI / 180);
|
let rad = deg * (Math.PI / 180);
|
||||||
this.track.indexRad = rad;
|
this.track.indexRad = rad;
|
||||||
this.mesh.rotation.x = rad;
|
this.mesh.rotation.x = -rad;
|
||||||
this.setTopZ(this.track.top);
|
this.setTopZ(this.track.top);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -488,16 +488,16 @@ class Widget {
|
||||||
track.tzoff = mbz - z;
|
track.tzoff = mbz - z;
|
||||||
if (track.indexed) {
|
if (track.indexed) {
|
||||||
let rad = track.indexRad;
|
let rad = track.indexRad;
|
||||||
let mz = track.box.h / 2;
|
let mz = track.box.d / 2;
|
||||||
let dx = Math.cos(rad) * mz;
|
let dx = Math.sin(rad) * mz;
|
||||||
let dy = Math.sin(rad) * mz;
|
let dy = mz - Math.cos(rad) * mz;
|
||||||
track.delta = {
|
track.delta = {
|
||||||
x: 0,
|
x: 0,
|
||||||
y: Math.sin(rad) * mz,
|
y: -dx,
|
||||||
z: -(track.indexed / 2) + (mz - dx)
|
z: -(track.indexed / 2) + dy
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
track.delta = { x:0, y:0, z:0};
|
track.delta = { x:0, y:0, z:0 };
|
||||||
this.mesh.rotation.x = 0;
|
this.mesh.rotation.x = 0;
|
||||||
}
|
}
|
||||||
this.modified |= (ltop !== z);
|
this.modified |= (ltop !== z);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue