diff --git a/app/src/modules/simulation/vehicle/navMesh/navMeshDetails.tsx b/app/src/modules/simulation/vehicle/navMesh/navMeshDetails.tsx index 7290466..e0579a0 100644 --- a/app/src/modules/simulation/vehicle/navMesh/navMeshDetails.tsx +++ b/app/src/modules/simulation/vehicle/navMesh/navMeshDetails.tsx @@ -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; }