recast-navigation 0.32.0 → 0.34.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -4
- package/package.json +9 -9
package/README.md
CHANGED
|
@@ -377,7 +377,11 @@ If many obstacle requests have been made and you need to avoid reaching the 64 o
|
|
|
377
377
|
const position = { x: 0, y: 0, z: 0 };
|
|
378
378
|
const halfExtents = { x: 1, y: 1, z: 1 };
|
|
379
379
|
const angle = 0;
|
|
380
|
-
const addBoxObstacleResult = tileCache.addBoxObstacle(
|
|
380
|
+
const addBoxObstacleResult = tileCache.addBoxObstacle(
|
|
381
|
+
position,
|
|
382
|
+
halfExtents,
|
|
383
|
+
angle
|
|
384
|
+
);
|
|
381
385
|
const boxObstacle = addBoxObstacleResult.obstacle;
|
|
382
386
|
|
|
383
387
|
/* add a Cylinder obstacle to the NavMesh */
|
|
@@ -549,18 +553,28 @@ const { navMesh } = importNavMesh(navMeshExport);
|
|
|
549
553
|
To export a TileCache and NavMesh, the usage varies slightly:
|
|
550
554
|
|
|
551
555
|
```ts
|
|
552
|
-
import {
|
|
556
|
+
import { exportTileCache, importTileCache } from 'recast-navigation';
|
|
553
557
|
|
|
554
558
|
/* exporting */
|
|
555
559
|
// pass both the navMesh and the tileCache
|
|
556
|
-
const navMeshExport: Uint8Array =
|
|
560
|
+
const navMeshExport: Uint8Array = exportTileCache(navMesh, tileCache);
|
|
557
561
|
|
|
558
562
|
/* importing */
|
|
559
563
|
// also pass the TileCacheMeshProcess implementation for the tile cache
|
|
560
564
|
// if you used `generateTileCache` and didn't provide one, `createDefaultTileCacheMeshProcess` returns the default TileCacheMeshProcess `generateTileCache` uses
|
|
561
565
|
const tileCacheMeshProcess = createDefaultTileCacheMeshProcess();
|
|
562
566
|
|
|
563
|
-
|
|
567
|
+
// otherwise, you can use your own TileCacheMeshProcess
|
|
568
|
+
const customTileCacheMeshProcess = new TileCacheMeshProcess(
|
|
569
|
+
(navMeshCreateParams, polyAreas, polyFlags) => {
|
|
570
|
+
for (let i = 0; i < navMeshCreateParams.polyCount(); ++i) {
|
|
571
|
+
polyAreas.set(i, 0);
|
|
572
|
+
polyFlags.set(i, 1);
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
);
|
|
576
|
+
|
|
577
|
+
const { navMesh, tileCache, allocator, compressor } = importTileCache(
|
|
564
578
|
navMeshExport,
|
|
565
579
|
tileCacheMeshProcess
|
|
566
580
|
);
|
package/package.json
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"email": "isaac@isaacmason.com",
|
|
19
19
|
"url": "https://isaacmason.com/"
|
|
20
20
|
},
|
|
21
|
-
"version": "0.
|
|
21
|
+
"version": "0.34.0",
|
|
22
22
|
"license": "MIT",
|
|
23
23
|
"homepage": "https://github.com/isaac-mason/recast-navigation-js",
|
|
24
24
|
"bugs": {
|
|
@@ -64,18 +64,18 @@
|
|
|
64
64
|
"storybook": "storybook dev -p 6006",
|
|
65
65
|
"build-storybook": "storybook build",
|
|
66
66
|
"test": "tsc && vitest run",
|
|
67
|
-
"lint": "eslint
|
|
67
|
+
"lint": "eslint src"
|
|
68
68
|
},
|
|
69
69
|
"dependencies": {
|
|
70
|
-
"@recast-navigation/core": "0.
|
|
71
|
-
"@recast-navigation/generators": "0.
|
|
72
|
-
"@recast-navigation/three": "0.
|
|
70
|
+
"@recast-navigation/core": "0.34.0",
|
|
71
|
+
"@recast-navigation/generators": "0.34.0",
|
|
72
|
+
"@recast-navigation/three": "0.34.0"
|
|
73
73
|
},
|
|
74
74
|
"devDependencies": {
|
|
75
75
|
"@babel/core": "^7.24.5",
|
|
76
76
|
"@babel/preset-env": "^7.24.5",
|
|
77
77
|
"@babel/preset-typescript": "^7.24.1",
|
|
78
|
-
"@isaac-mason/eslint-config-typescript": "^0.0.
|
|
78
|
+
"@isaac-mason/eslint-config-typescript": "^0.0.9",
|
|
79
79
|
"@mdx-js/react": "^2.3.0",
|
|
80
80
|
"@pmndrs/assets": "^1.6.0",
|
|
81
81
|
"@react-three/drei": "^9.105.4",
|
|
@@ -94,9 +94,9 @@
|
|
|
94
94
|
"@storybook/react-vite": "^8.0.9",
|
|
95
95
|
"@types/react": "^18.3.1",
|
|
96
96
|
"@types/react-dom": "^18.2.8",
|
|
97
|
-
"@types/three": "^0.
|
|
97
|
+
"@types/three": "^0.167.1",
|
|
98
98
|
"@vitejs/plugin-react": "^4.2.1",
|
|
99
|
-
"eslint": "^
|
|
99
|
+
"eslint": "^9.6.0",
|
|
100
100
|
"leva": "^0.9.35",
|
|
101
101
|
"react": "^18.3.1",
|
|
102
102
|
"react-dom": "^18.2.0",
|
|
@@ -105,7 +105,7 @@
|
|
|
105
105
|
"rollup-plugin-filesize": "^10.0.0",
|
|
106
106
|
"storybook": "^8.0.9",
|
|
107
107
|
"suspend-react": "^0.1.3",
|
|
108
|
-
"three": "^0.
|
|
108
|
+
"three": "^0.167.1",
|
|
109
109
|
"three-pathfinding": "^1.2.0",
|
|
110
110
|
"typescript": "^5.4.3",
|
|
111
111
|
"vite": "^5.2.10",
|