This commit is contained in:
2025-07-09 17:15:24 +05:30
parent 10a35b4892
commit a8d505f9a9

View File

@@ -5,6 +5,7 @@ import { generateSoloNavMesh } from "@recast-navigation/generators";
import { init as initRecastNavigation } from "@recast-navigation/core";
import { DebugDrawer, getPositionsAndIndices } from "@recast-navigation/three";
import { useSceneContext } from "../../../scene/sceneContext";
import { useToggleView } from "../../../../store/builder/store";
interface NavMeshDetailsProps {
setNavMesh: (navMesh: any) => void;
@@ -19,8 +20,10 @@ export default function NavMeshDetails({
const { aisles } = aisleStore();
const { scene } = useThree();
const { walls } = wallStore();
const { toggleView } = useToggleView();
useEffect(() => {
if (toggleView) return;
const initializeNavigation = async () => {
try {
await initRecastNavigation();
@@ -64,7 +67,7 @@ export default function NavMeshDetails({
};
initializeNavigation();
}, [scene, groupRef, aisles, walls]);
}, [scene, groupRef, aisles, walls, toggleView]);
return null;
}