recast-navigation 0.39.0 → 0.41.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.
Files changed (2) hide show
  1. package/README.md +46 -98
  2. package/package.json +32 -39
package/README.md CHANGED
@@ -22,6 +22,34 @@
22
22
 
23
23
  This library provides high level APIs that make it easy to get started creating navigation meshes, querying them, and simulating crowds. It also provides lower-level APIs that give you fine-grained control over the navmesh generation process.
24
24
 
25
+ ### Usage
26
+
27
+ There are a few common ways you can make use of recast-navigation-js, depending on your needs:
28
+
29
+ #### 1. **Runtime NavMesh Generation, NavMesh querying with Detour APIs**
30
+
31
+ You can use this library to generate a navigation mesh at runtime for procedurally generated or frequently changing environments, and use Detour APIs for pathfinding and spatial reasoning on the navigation mesh.
32
+
33
+ #### 2. **Offline NavMesh Generation (Recast Format), NavMesh querying with Detour APIs**
34
+
35
+ If your environment is largely static, you can generate a navigation mesh offline and import it at runtime. This is useful for larger environments where runtime generation would be too slow, or if you want to avoid the overhead of runtime generation.
36
+
37
+ The TileCache Detour API provides support for temporary obstacles, which can be used to create semi-dynamic environments.
38
+
39
+ #### 3. **Offline NavMesh Generation (GLTF or Custom Format), external NavMesh querying solution**
40
+
41
+ You can opt to only use the navigation mesh generation capabilities of this library, and export the generated navigation mesh in a GLTF or custom format. You can then use an external pathfinding solution (for example, [three-pathfinding](https://github.com/donmccurdy/three-pathfinding)) for querying the generated navigation mesh. ([See recast-navigation-js & three-pathfinding example](https://github.com/isaac-mason/recast-navigation-js/blob/main/packages/recast-navigation/.storybook/stories/external-use/three-pathfinding.stories.tsx))
42
+
43
+ This is worth considering if:
44
+ - you need more flexibility than the detour WASM API affords
45
+ - you do have a dynamic environment
46
+ - you don't require more complex functionality in detour such as temporary obstacles and crowd simulation
47
+ - minimising your bundle size is important, and the WASM library file size doesn't fit within your budget
48
+
49
+ For simpler projects your navigation mesh generation needs may be entirely served by the [NavMesh Generator](https://navmesh.isaacmason.com/) website, which allows you to generate a navigation mesh from an uploaded model and export it in a GLTF format.
50
+
51
+ If you want to integrate navigation mesh generation into your project's asset pipeline, see this demonstration of how to create a custom config file for the glTF Transform CLI, and implement navmesh generation as a custom command: https://github.com/donmccurdy/glTF-Transform-Recast-Config
52
+
25
53
  ## Examples
26
54
 
27
55
  Go to the [examples website](https://recast-navigation-js.isaacmason.com) to see the project in action:
@@ -49,17 +77,19 @@ export default defineConfig(() => ({
49
77
  )}
50
78
  ```
51
79
 
52
- If you are planning to use the library with three.js, install the `@recast-navigation/three` package for three.js helpers:
80
+ You can also install individual packages from the `@recast-navigation` npm organization:
81
+ - [`@recast-navigation/core`](https://www.npmjs.com/package/@recast-navigation/core) - The core library that provides the main functionality.
82
+ - [`@recast-navigation/generators`](https://www.npmjs.com/package/@recast-navigation/generators) - High level NavMesh generator functions.
83
+ - [`@recast-navigation/wasm`](https://www.npmjs.com/package/@recast-navigation/wasm) - The WebAssembly build of the Recast and Detour libraries, used internally by `@recast-navigation/core`.
53
84
 
54
- ```sh
55
- npm install @recast-navigation/three
56
- ```
85
+ The `@recast-navigation` npm organization contains some packages that simplify integration with other libraries and frameworks:
57
86
 
58
- If you are planning to use the library with playcanvas, install the `@recast-navigation/playcanvas` package for playcanvas helpers:
87
+ - [`@recast-navigation/three`](https://www.npmjs.com/package/@recast-navigation/three) - Helpers for integrating with three.js.
88
+ - [`@recast-navigation/playcanvas`](https://www.npmjs.com/package/@recast-navigation/playcanvas) - Helpers for integrating with playcanvas.
59
89
 
60
- ```sh
61
- npm install @recast-navigation/playcanvas
62
- ```
90
+ There are also some community maintained packages that provide integrations with other libraries:
91
+
92
+ - [`babylonjs-recast-navigation-js`](https://github.com/RolandCsibrei/babylonjs-recast-navigation-js) - A drop-in implementation for the Babylon.js navigation interface implemented with recast-navigation-js.
63
93
 
64
94
  **Usage without bundlers**
65
95
 
@@ -101,20 +131,17 @@ API Documentation can be found at [https://docs.recast-navigation-js.isaacmason.
101
131
 
102
132
  For information on changes between versions, see [CHANGELOG.md](https://github.com/isaac-mason/recast-navigation-js/tree/main/packages/recast-navigation/CHANGELOG.md)
103
133
 
104
- To get the most out of this library, you should have some familiarity with the Recast and Detour libraries. These are some good resources to get started:
105
-
134
+ These are useful resources for understanding the recast navmesh generation process, which will help you understand how to use this library effectively:
106
135
  - https://recastnav.com/md_Docs__1_Introducation.html
107
136
  - https://www.unrealdoc.com/p/navigation-mesh
108
137
 
109
- Documentation for the Recast and Detour c++ libraries can be found here:
138
+ Documentation and resources for the Recast and Detour c++ libraries can be found here:
110
139
 
111
140
  - [Recast Navigation Website](http://recastnav.com/)
112
141
  - [Recast Navigation GitHub](https://github.com/recastnavigation/recastnavigation)
113
142
  - [Recast Navigation Google Discussions](https://groups.google.com/g/recastnavigation)
114
143
 
115
- The GitHub issues and Google Discussions are great resources for learning about the library and getting guidance on common issues.
116
-
117
- ## Usage
144
+ ## Getting Started
118
145
 
119
146
  ### Initialization
120
147
 
@@ -171,7 +198,7 @@ See the docs for more information on generator options: https://docs.recast-navi
171
198
 
172
199
  It's possible to build a NavMesh in a Web Worker. This can be useful for offloading heavy computation from the main thread.
173
200
 
174
- The library doesn't include a web worker, but it's straightforward to create your own. An example of solo nav mesh generation in a web worker can be found here: https://github.com/isaac-mason/recast-navigation-js/tree/next/examples/three-vite-worker-example
201
+ The library doesn't include a web worker, but it's straightforward to create your own. An example of solo nav mesh generation in a web worker can be found here: https://github.com/isaac-mason/recast-navigation-js/tree/main/examples/three-vite-worker-example
175
202
 
176
203
  The example uses `importNavMesh` and `exportNavMesh` to serialize and deserialize a NavMesh for transfer between the main thread and the web worker.
177
204
 
@@ -596,91 +623,12 @@ const { navMesh, tileCache, allocator, compressor } = importTileCache(
596
623
  );
597
624
  ```
598
625
 
599
- ## Packages
600
-
601
- Functionality is spread across packages in the `@recast-navigation/*` organization.
602
-
603
- The `recast-navigation` package is the umbrella package for core packages, and has entrypoints for `@recast-navigation/core` and `@recast-navigation/generators`.
604
-
605
- All packages ship as ECMAScript modules, and are compatible with Node.js and browser environments.
606
-
607
- ### [**`recast-navigation`**](https://github.com/isaac-mason/recast-navigation-js/tree/main/packages/recast-navigation)
608
-
609
- [![Version](https://img.shields.io/npm/v/recast-navigation)](https://www.npmjs.com/package/recast-navigation)
610
-
611
- The umbrella package for `recast-navigation`.
612
-
613
- ```bash
614
- > npm install recast-navigation
615
- ```
616
-
617
- ```ts
618
- import { init } from 'recast-navigation';
619
- import { generateSoloNavMesh } from 'recast-navigation/generators';
620
- ```
621
-
622
- ### [**`@recast-navigation/core`**](https://github.com/isaac-mason/recast-navigation-js/tree/main/packages/recast-navigation-core)
623
-
624
- [![Version](https://img.shields.io/npm/v/@recast-navigation/core)](https://www.npmjs.com/package/@recast-navigation/core)
625
-
626
- The core library!
627
-
628
- ```bash
629
- > npm install @recast-navigation/core
630
- ```
631
-
632
- ### [**`@recast-navigation/generators`**](https://github.com/isaac-mason/recast-navigation-js/tree/main/packages/recast-navigation-generators)
633
-
634
- [![Version](https://img.shields.io/npm/v/@recast-navigation/generators)](https://www.npmjs.com/package/@recast-navigation/generators)
635
-
636
- NavMesh generator implementations. Use these to get started, and as a basis for your own NavMesh generator.
637
-
638
- ```bash
639
- > npm install @recast-navigation/generators
640
- ```
641
-
642
- ### [**`@recast-navigation/three`**](https://github.com/isaac-mason/recast-navigation-js/tree/main/packages/recast-navigation-three)
643
-
644
- [![Version](https://img.shields.io/npm/v/@recast-navigation/three)](https://www.npmjs.com/package/@recast-navigation/three)
645
-
646
- Helpers for three.js.
647
-
648
- ```bash
649
- > npm install @recast-navigation/three
650
- ```
651
-
652
- ### [**`@recast-navigation/playcanvas`**](https://github.com/isaac-mason/recast-navigation-js/tree/main/packages/recast-navigation-playcanvas)
653
-
654
- [![Version](https://img.shields.io/npm/v/@recast-navigation/playcanvas)](https://www.npmjs.com/package/@recast-navigation/playcanvas)
655
-
656
- Helpers for playcanvas.
657
-
658
- ```bash
659
- > npm install @recast-navigation/playcanvas
660
- ```
661
-
662
- ### [**`@recast-navigation/wasm`**](https://github.com/isaac-mason/recast-navigation-js/tree/main/packages/recast-navigation-wasm)
663
-
664
- [![Version](https://img.shields.io/npm/v/@recast-navigation/wasm)](https://www.npmjs.com/package/@recast-navigation/wasm)
665
-
666
- The WebAssembly build of the Recast and Detour libraries.
667
-
668
- You regularly won't need to use this package directly, `@recast-navigation/core` uses it internally.
669
-
670
- ```bash
671
- > npm install @recast-navigation/wasm
672
- ```
673
-
674
- ## Apps
675
-
676
- ### [NavMesh Generator](https://navmesh.isaacmason.com/)
677
-
678
- A website for generating navmeshes for your game. Drag 'n' drop your GLTF, fine tune your settings, and download your navmesh!
679
-
680
- ([source](./apps/navmesh-website/))
681
-
682
626
  ## Acknowledgements
683
627
 
684
628
  - This would not exist without [Recast Navigation](https://github.com/recastnavigation/recastnavigation) itself!
685
629
  - The demos use recastnavigation's level mesh
686
630
  - The WASM build was based on the [Babylon.js Recast Extension](https://github.com/BabylonJS/Extensions/tree/master/recastjs)
631
+
632
+ ## LICENSE
633
+
634
+ This project is licensed under the MIT License. See: [LICENSE](./LICENSE).
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.39.0",
21
+ "version": "0.41.0",
22
22
  "license": "MIT",
23
23
  "homepage": "https://github.com/isaac-mason/recast-navigation-js",
24
24
  "bugs": {
@@ -55,52 +55,45 @@
55
55
  "build": "yarn clean && rollup --config rollup.config.js --bundleConfigAsCjs",
56
56
  "storybook": "storybook dev -p 6006",
57
57
  "build-storybook": "storybook build",
58
- "test": "tsc && vitest run",
59
- "lint": "eslint src"
58
+ "test": "tsc && vitest run"
60
59
  },
61
60
  "dependencies": {
62
- "@recast-navigation/core": "0.39.0",
63
- "@recast-navigation/generators": "0.39.0"
61
+ "@recast-navigation/core": "0.41.0",
62
+ "@recast-navigation/generators": "0.41.0"
64
63
  },
65
64
  "devDependencies": {
66
- "@babel/core": "^7.24.5",
67
- "@babel/preset-env": "^7.24.5",
68
- "@babel/preset-typescript": "^7.24.1",
69
- "@isaac-mason/eslint-config-typescript": "^0.0.9",
70
- "@mdx-js/react": "^2.3.0",
65
+ "@babel/core": "^7.28.0",
66
+ "@babel/preset-env": "^7.28.0",
67
+ "@babel/preset-typescript": "^7.27.1",
68
+ "@mdx-js/react": "^3.1.0",
71
69
  "@pmndrs/assets": "^1.6.0",
72
- "@react-three/drei": "^9.105.4",
73
- "@react-three/fiber": "^8.16.3",
70
+ "@react-three/drei": "^10.4.2",
71
+ "@react-three/fiber": "^9.2.0",
74
72
  "@rollup/plugin-babel": "^6.0.4",
75
- "@rollup/plugin-commonjs": "^25.0.7",
76
- "@rollup/plugin-node-resolve": "^15.0.1",
77
- "@rollup/plugin-typescript": "^11.1.6",
78
- "@storybook/addon-actions": "^8.0.9",
79
- "@storybook/addon-essentials": "^8.0.9",
80
- "@storybook/addon-interactions": "^8.0.9",
81
- "@storybook/addon-links": "^8.0.9",
82
- "@storybook/addon-mdx-gfm": "^8.0.9",
83
- "@storybook/react": "^8.0.9",
84
- "@storybook/react-vite": "^8.0.9",
85
- "@types/react": "^18.3.1",
86
- "@types/react-dom": "^18.2.8",
87
- "@types/three": "^0.172.0",
88
- "@vitejs/plugin-react": "^4.2.1",
89
- "eslint": "^9.6.0",
90
- "leva": "^0.9.35",
91
- "react": "^18.3.1",
92
- "react-dom": "^18.2.0",
93
- "rollup": "^4.14.0",
94
- "rollup-plugin-copy": "^3.4.0",
73
+ "@rollup/plugin-commonjs": "^28.0.6",
74
+ "@rollup/plugin-node-resolve": "^16.0.1",
75
+ "@rollup/plugin-typescript": "^12.1.4",
76
+ "@storybook/addon-docs": "^9.0.15",
77
+ "@storybook/addon-links": "^9.0.15",
78
+ "@storybook/react-vite": "^9.0.15",
79
+ "@types/react": "^19.1.8",
80
+ "@types/react-dom": "^19.1.6",
81
+ "@types/three": "^0.178.0",
82
+ "@vitejs/plugin-react": "^4.6.0",
83
+ "leva": "^0.10.0",
84
+ "react": "^19.1.0",
85
+ "react-dom": "^19.1.0",
86
+ "rollup": "^4.44.2",
87
+ "rollup-plugin-copy": "^3.5.0",
95
88
  "rollup-plugin-filesize": "^10.0.0",
96
- "storybook": "^8.0.9",
89
+ "storybook": "^9.0.15",
97
90
  "suspend-react": "^0.1.3",
98
- "three": "^0.172.0",
99
- "three-pathfinding": "^1.2.0",
100
- "typescript": "^5.4.3",
101
- "vite": "^5.4.8",
102
- "vitest": "^2.1.2",
103
- "zustand": "^4.5.2"
91
+ "three": "^0.178.0",
92
+ "three-pathfinding": "^1.3.0",
93
+ "typescript": "^5.8.3",
94
+ "vite": "^7.0.2",
95
+ "vitest": "^3.2.4",
96
+ "zustand": "^5.0.6"
104
97
  },
105
98
  "packageManager": "yarn@3.2.2"
106
99
  }