#
vincentlu
1 天以前 80633cba7e121e217e1cd282326ead80759ba8d5
#
2个文件已修改
55 ■■■■■ 已修改文件
zy-acs-flow/public/model/latent/body.fbx 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-flow/src/map/insight/agv/AgvMain.jsx 55 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-flow/public/model/latent/body.fbx
Binary files differ
zy-acs-flow/src/map/insight/agv/AgvMain.jsx
@@ -76,12 +76,61 @@
                    return box.getSize(new THREE.Vector3());
                };
                const orientUnderdriveMesh = (mesh) => {
                    const quarterTurns = [0, Math.PI / 2, Math.PI, Math.PI * 1.5];
                    let bestRotation = new THREE.Euler(0, 0, 0);
                    let bestScore = null;
                    quarterTurns.forEach((x) => {
                        quarterTurns.forEach((y) => {
                            quarterTurns.forEach((z) => {
                                mesh.rotation.set(x, y, z);
                                mesh.updateMatrixWorld(true);
                                const size = new THREE.Box3()
                                    .setFromObject(mesh)
                                    .getSize(new THREE.Vector3());
                                const score = {
                                    height: size.y,
                                    footprint: size.x * size.z,
                                    widthBias: Math.max(size.x, size.z),
                                };
                                if (
                                    !bestScore
                                    || score.height < bestScore.height - 0.001
                                    || (
                                        Math.abs(score.height - bestScore.height) <= 0.001
                                        && score.footprint > bestScore.footprint + 0.001
                                    )
                                    || (
                                        Math.abs(score.height - bestScore.height) <= 0.001
                                        && Math.abs(score.footprint - bestScore.footprint) <= 0.001
                                        && score.widthBias > bestScore.widthBias + 0.001
                                    )
                                ) {
                                    bestScore = score;
                                    bestRotation = new THREE.Euler(x, y, z);
                                }
                            });
                        });
                    });
                    mesh.rotation.copy(bestRotation);
                    mesh.updateMatrixWorld(true);
                };
                if (agvModel === 'UNDERDRIVE_AGV') {
                    loadModel('model/latent/body.fbx').then((bodyMesh) => {
                        const scaleVal = 1;
                        const scaleVal = 0.55;
                        bodyMesh.scale.set(scaleVal, scaleVal, scaleVal);
                        orientUnderdriveMesh(bodyMesh);
                        bodyMesh.rotateX(Math.PI);
                        const size = centerMeshToGround(bodyMesh);
                        const horizontalSize = Math.max(size.x, size.z);
                        const agvGroup = new THREE.Group();
                        agvGroup.add(bodyMesh);
@@ -90,8 +139,8 @@
                        addObject(agvGroup);
                        threeRef.current?.rePerspective(
                            Math.max(size.y, 250),
                            Math.max(size.y * 1.2, 320),
                            Math.max(size.y, 150),
                            Math.max(horizontalSize, 560),
                        );
                    }).catch((error) => {
                        console.error('Failed to load latent/body.fbx.', error);