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