Skip to content

Commit

Permalink
Merge branch 'feature-three' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
tsengyushiang committed Sep 14, 2024
2 parents 028e134 + 5f7dd01 commit c9b2da0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
16 changes: 8 additions & 8 deletions src/three/Layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import * as THREE from "three";
import { init } from "recast-navigation";
import { threeToSoloNavMesh, NavMeshHelper } from "recast-navigation/three";

await init();

type Vector3Pair = [number[], number[]];

class Walls extends THREE.BufferGeometry {
Expand Down Expand Up @@ -167,12 +165,14 @@ const Layout = () => {
]);
geometry.setFloor(20, 20);

const { navMesh } = threeToSoloNavMesh([new THREE.Mesh(geometry)]);
let navMeshHelper = null;
if (navMesh) {
navMeshHelper = new NavMeshHelper({ navMesh });
scene.add(navMeshHelper);
}
let navMeshHelper: NavMeshHelper;
init().then(() => {
const { navMesh } = threeToSoloNavMesh([new THREE.Mesh(geometry)]);
if (navMesh) {
navMeshHelper = new NavMeshHelper({ navMesh });
scene.add(navMeshHelper);
}
});

return () => {
if (navMeshHelper) {
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.app.tsbuildinfo
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"root":["./src/App.tsx","./src/main.tsx","./src/stories/App.stories.ts"],"version":"5.6.2"}
{"root":["./src/App.tsx","./src/main.tsx","./src/stories/App.stories.ts","./src/three/Layout.ts","./src/three/index.tsx"],"version":"5.6.2"}

0 comments on commit c9b2da0

Please sign in to comment.