streamline aisle filtering logic in PolygonGenerator and enhance navigation error handling
This commit is contained in:
parent
40a32d1497
commit
566fd87526
|
@ -56,7 +56,7 @@ export default function NavMeshDetails({
|
|||
// scene.add(debugDrawer);
|
||||
} catch (error) {
|
||||
echo.error("Failed to initialize navigation")
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
initializeNavigation();
|
||||
|
|
|
@ -19,25 +19,24 @@ export default function PolygonGenerator({
|
|||
let allLines = arrayLinesToObject(lines.current);
|
||||
const wallLines = allLines?.filter((line) => line?.type === "WallLine");
|
||||
const aisleLines = allLines?.filter((line) => line?.type === "AisleLine")
|
||||
// const aisleLines = allLines?.filter((line) => line?.type === "AisleLine")
|
||||
console.log('aisles: ', aisles.map((aisle) => aisle.points.map((point) => point.position)));
|
||||
const result = aisles.map((aisle) =>
|
||||
aisle.points.map((point) => ({
|
||||
position: [point.position[0], point.position[2]],
|
||||
uuid: point.pointUuid,
|
||||
}))
|
||||
);
|
||||
const result = aisles
|
||||
.filter(
|
||||
(aisle) =>
|
||||
aisle.type.aisleType === "dotted-aisle" ||
|
||||
aisle.type.aisleType === "solid-aisle" ||
|
||||
aisle.type.aisleType === "dashed-aisle" ||
|
||||
aisle.type.aisleType === "arc-aisle"
|
||||
)
|
||||
.map((aisle) =>
|
||||
aisle.points.map((point) => ({
|
||||
position: [point.position[0], point.position[2]],
|
||||
uuid: point.pointUuid,
|
||||
}))
|
||||
);
|
||||
const wallPoints = wallLines
|
||||
.map((pair) => pair?.line.map((vals) => vals.position))
|
||||
.filter((wall): wall is THREE.Vector3[] => !!wall);
|
||||
|
||||
// const result = aisleLines.map((pair) =>
|
||||
// pair?.line.map((point) => ({
|
||||
// position: [point.position.x, point.position.z],
|
||||
// uuid: point.uuid,
|
||||
// }))
|
||||
// );
|
||||
|
||||
|
||||
if (!result || result.some((line) => !line)) {
|
||||
return;
|
||||
|
|
Loading…
Reference in New Issue