Dwinzo_dev/app/src/modules/builder/agv/agv.tsx

46 lines
1.4 KiB
TypeScript
Raw Normal View History

import PolygonGenerator from "./polygonGenerator";
2025-03-26 12:58:14 +00:00
import { useThree } from "@react-three/fiber";
import { useEffect, useMemo, useRef, useState } from "react";
2025-03-26 12:58:14 +00:00
import * as THREE from "three";
import * as Types from "../../../types/world/worldTypes";
2025-03-26 12:58:14 +00:00
import PathNavigator from "./pathNavigator";
import NavMeshDetails from "./navMeshDetails";
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 },
],
// [
// { 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 },
],
], []);
let groupRef = useRef() as Types.RefGroup;
const [navMesh, setNavMesh] = useState();
2025-03-26 12:58:14 +00:00
return (
<>
<PolygonGenerator groupRef={groupRef} lines={lines} plane={plane} />
<NavMeshDetails
2025-03-26 13:10:28 +00:00
lines={lines}
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) => (
<PathNavigator navMesh={navMesh} selectedPoints={pair} key={i} />
2025-03-26 12:58:14 +00:00
))}
<group ref={groupRef} visible={false} name="Meshes"></group>
2025-03-26 12:58:14 +00:00
</>
);
};
export default Agv;