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