2025-03-27 10:07:16 +00:00
|
|
|
import PolygonGenerator from "./polygonGenerator";
|
2025-03-26 12:58:14 +00:00
|
|
|
import { useThree } from "@react-three/fiber";
|
2025-03-29 12:44:29 +00:00
|
|
|
import { useEffect, useMemo, useRef, useState } from "react";
|
2025-03-26 12:58:14 +00:00
|
|
|
import * as THREE from "three";
|
2025-03-27 10:07:16 +00:00
|
|
|
import * as Types from "../../../types/world/worldTypes";
|
2025-03-26 12:58:14 +00:00
|
|
|
import PathNavigator from "./pathNavigator";
|
2025-03-27 10:07:16 +00:00
|
|
|
import NavMeshDetails from "./navMeshDetails";
|
|
|
|
|
2025-03-29 12:44:29 +00:00
|
|
|
const Agv = ({ lines, plane }: { lines: Types.RefLines; plane: Types.RefMesh; }) => {
|
|
|
|
const pathPoints = useMemo(() => [
|
2025-03-26 12:58:14 +00:00
|
|
|
[
|
|
|
|
{ x: 8.477161935339709, y: 0, z: 17.41343083550102 },
|
|
|
|
{ x: 9.175416491482693, y: 0, z: -12.361001232663693 },
|
|
|
|
],
|
2025-03-27 10:07:16 +00:00
|
|
|
// [
|
|
|
|
// { x: 13.508213355232144, y: 0, z: -15.456970649652018 },
|
|
|
|
// { x: -30.464866520869617, y: 0, z: 9.779806557688929 },
|
|
|
|
// ],
|
2025-03-26 12:58:14 +00:00
|
|
|
[
|
|
|
|
{ x: 16.792040856420844, y: 0, z: 15.86281907549489 },
|
|
|
|
{ x: -42.77173264503395, y: 0, z: -15.821322764400804 },
|
|
|
|
],
|
2025-03-29 12:44:29 +00:00
|
|
|
], []);
|
|
|
|
|
2025-03-27 10:07:16 +00:00
|
|
|
let groupRef = useRef() as Types.RefGroup;
|
|
|
|
const [navMesh, setNavMesh] = useState();
|
2025-03-26 12:58:14 +00:00
|
|
|
|
|
|
|
return (
|
|
|
|
<>
|
2025-03-27 10:07:16 +00:00
|
|
|
<PolygonGenerator groupRef={groupRef} lines={lines} plane={plane} />
|
|
|
|
<NavMeshDetails
|
2025-03-26 13:10:28 +00:00
|
|
|
lines={lines}
|
2025-03-27 10:07:16 +00:00
|
|
|
setNavMesh={setNavMesh}
|
|
|
|
groupRef={groupRef}
|
2025-03-26 13:10:28 +00:00
|
|
|
plane={plane}
|
|
|
|
/>
|
2025-03-26 12:58:14 +00:00
|
|
|
{pathPoints.map((pair, i) => (
|
2025-03-27 10:07:16 +00:00
|
|
|
<PathNavigator navMesh={navMesh} selectedPoints={pair} key={i} />
|
2025-03-26 12:58:14 +00:00
|
|
|
))}
|
2025-03-27 10:07:16 +00:00
|
|
|
<group ref={groupRef} visible={false} name="Meshes"></group>
|
2025-03-26 12:58:14 +00:00
|
|
|
</>
|
|
|
|
);
|
2025-03-27 10:07:16 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
export default Agv;
|