31 lines
1.1 KiB
TypeScript
31 lines
1.1 KiB
TypeScript
import { useRef } from "react";
|
|
import { useNavMesh } from "../../../store/store";
|
|
import PolygonGenerator from "./polygonGenerator";
|
|
import NavMeshDetails from "./navMeshDetails";
|
|
import * as CONSTANTS from "../../../types/world/worldConstants";
|
|
import * as Types from "../../../types/world/worldTypes";
|
|
|
|
type NavMeshCreatorProps = {
|
|
lines: Types.RefLines
|
|
};
|
|
|
|
function NavMeshCreator({ lines }: NavMeshCreatorProps) {
|
|
let groupRef = useRef() as Types.RefGroup;
|
|
const { setNavMesh } = useNavMesh();
|
|
|
|
return (
|
|
<>
|
|
<PolygonGenerator groupRef={groupRef} lines={lines} />
|
|
<NavMeshDetails lines={lines} setNavMesh={setNavMesh} groupRef={groupRef} />
|
|
|
|
<group ref={groupRef} visible={false} name="Meshes">
|
|
<mesh rotation-x={CONSTANTS.planeConfig.rotation} position={CONSTANTS.planeConfig.position3D} receiveShadow>
|
|
<planeGeometry args={[300, 300]} />
|
|
<meshBasicMaterial color={CONSTANTS.planeConfig.color} />
|
|
</mesh>
|
|
</group>
|
|
</>
|
|
)
|
|
}
|
|
|
|
export default NavMeshCreator |