修复:镜像的EntityRef坐标轴显示错误的问题

pull/1816/head
ChenX 3 years ago
parent 70b1bef695
commit 01289750b5

@ -67,6 +67,10 @@ export class UCSServices
}
const TempX = new Vector3;
const TempY = new Vector3;
const TempZ = new Vector3;
const TempMtx = new Matrix4;
export function MatrixToPreViewMat(mtx: Matrix4, view: Viewer, obj: Object3D, displayPosition: UCSPsotion, repairPos = true)
{
@ -84,10 +88,15 @@ export function MatrixToPreViewMat(mtx: Matrix4, view: Viewer, obj: Object3D, di
else
obj.position.set(-view.Width / 2 + 180, -view.Height / 2 + 130, 0);
let tempMat = mtx.clone();
tempMat.multiplyMatrices(view.Camera.matrixWorldInverse, tempMat);
tempMat.multiplyMatrices(view.PreViewer.Camera.matrixWorld, tempMat);
obj.quaternion.setFromRotationMatrix(tempMat);
TempY.setFromMatrixColumn(mtx, 1);
TempZ.setFromMatrixColumn(mtx, 2);
TempX.crossVectors(TempY, TempZ);//因为镜像的EntityRef会导致显示错误,我们修复它的坐标系错误的问题
TempMtx.makeBasis(TempX, TempY, TempZ);
TempMtx.multiplyMatrices(view.Camera.matrixWorldInverse, TempMtx);
TempMtx.multiplyMatrices(view.PreViewer.Camera.matrixWorld, TempMtx);
obj.quaternion.setFromRotationMatrix(TempMtx);
obj.updateMatrix();
obj.updateMatrixWorld(true);
}

Loading…
Cancel
Save