recast-navigation 0.0.0-development-0 → 0.0.1
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 +11 -6
- package/package.json +17 -14
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@ A WebAssembly port of [Recast Navigation](https://github.com/recastnavigation/re
|
|
|
7
7
|
## Features
|
|
8
8
|
|
|
9
9
|
- 📐 NavMesh generation
|
|
10
|
-
- 🧭
|
|
10
|
+
- 🧭 Pathfinding
|
|
11
11
|
- 🧑🤝🧑 Crowd simulation
|
|
12
12
|
- 🌐 Web and Node support
|
|
13
13
|
- 💙 TypeScript friendly
|
|
@@ -76,17 +76,19 @@ navMesh.getRandomPointAround(position, radius);
|
|
|
76
76
|
|
|
77
77
|
Recast Navigation supports creating Box and Cylinder obstacles.
|
|
78
78
|
|
|
79
|
+
Note that in order to use obstacles, you must specify a `tileSize` in the `NavMeshConfig`.
|
|
80
|
+
|
|
79
81
|
```ts
|
|
80
82
|
/* add a Box obstacle to the NavMesh */
|
|
81
83
|
const position = { x: 0, y: 0, z: 0 };
|
|
82
84
|
const extent = { x: 1, y: 1, z: 1 };
|
|
83
85
|
const angle = 0;
|
|
84
|
-
const
|
|
86
|
+
const boxObstacle = navMesh.addBoxObstacle(position, extent, angle);
|
|
85
87
|
|
|
86
88
|
/* add a Cylinder obstacle to the NavMesh */
|
|
87
89
|
const radius = 1;
|
|
88
90
|
const height = 1;
|
|
89
|
-
const
|
|
91
|
+
const cylinderObstacle = navMesh.addCylinderObstacle(
|
|
90
92
|
position,
|
|
91
93
|
radius,
|
|
92
94
|
height,
|
|
@@ -94,8 +96,8 @@ const cylinderObstacleRef = navMesh.addCylinderObstacle(
|
|
|
94
96
|
);
|
|
95
97
|
|
|
96
98
|
/* remove the obstacles from the NavMesh */
|
|
97
|
-
navMesh.removeObstacle(
|
|
98
|
-
navMesh.removeObstacle(
|
|
99
|
+
navMesh.removeObstacle(boxObstacle);
|
|
100
|
+
navMesh.removeObstacle(cylinderObstacle);
|
|
99
101
|
```
|
|
100
102
|
|
|
101
103
|
### Crowds and Agents
|
|
@@ -154,6 +156,9 @@ const agentParameters = crowd.getAgentParameters(agentIndex);
|
|
|
154
156
|
const targetPosition = { x: 0, y: 0, z: 0 };
|
|
155
157
|
crowd.goto(agentIndex, targetPosition);
|
|
156
158
|
|
|
159
|
+
/* reset the agents target */
|
|
160
|
+
crowd.resetMoveTarget(agentIndex);
|
|
161
|
+
|
|
157
162
|
/* teleport the agent to a position */
|
|
158
163
|
crowd.teleport(agentIndex, targetPosition);
|
|
159
164
|
|
|
@@ -181,7 +186,7 @@ const debugNavMesh = navMesh.getDebugNavMesh();
|
|
|
181
186
|
const { positions, indices } = debugNavMesh.positions;
|
|
182
187
|
```
|
|
183
188
|
|
|
184
|
-
If you are using `@recast-navigation/three`, you can use `NavMeshHelper` to
|
|
189
|
+
If you are using `@recast-navigation/three`, you can use `NavMeshHelper` and `CrowdHelper` to visualize NavMeshes and Crowds.
|
|
185
190
|
|
|
186
191
|
### Exporting and Importing a NavMesh
|
|
187
192
|
|
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.0.
|
|
21
|
+
"version": "0.0.1",
|
|
22
22
|
"license": "MIT",
|
|
23
23
|
"homepage": "https://github.com/isaac-mason/recast-navigation-js",
|
|
24
24
|
"bugs": {
|
|
@@ -45,12 +45,12 @@
|
|
|
45
45
|
],
|
|
46
46
|
"scripts": {
|
|
47
47
|
"build": "rollup --config rollup.config.js --bundleConfigAsCjs",
|
|
48
|
-
"storybook": "
|
|
49
|
-
"build-storybook": "build
|
|
48
|
+
"storybook": "storybook dev -p 6006",
|
|
49
|
+
"build-storybook": "storybook build"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@recast-navigation/core": "0.0.
|
|
53
|
-
"@recast-navigation/three": "0.0.
|
|
52
|
+
"@recast-navigation/core": "0.0.1",
|
|
53
|
+
"@recast-navigation/three": "0.0.1"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
56
|
"three": "^0.150.1"
|
|
@@ -66,22 +66,25 @@
|
|
|
66
66
|
"@rollup/plugin-node-resolve": "^15.0.1",
|
|
67
67
|
"@rollup/plugin-terser": "^0.4.0",
|
|
68
68
|
"@rollup/plugin-typescript": "^11.0.0",
|
|
69
|
-
"@storybook/addon-actions": "^
|
|
70
|
-
"@storybook/addon-docs": "^
|
|
71
|
-
"@storybook/addon-essentials": "^
|
|
72
|
-
"@storybook/addon-interactions": "^
|
|
73
|
-
"@storybook/addon-links": "^
|
|
74
|
-
"@storybook/
|
|
75
|
-
"@storybook/
|
|
76
|
-
"@storybook/
|
|
77
|
-
"@storybook/react": "^
|
|
69
|
+
"@storybook/addon-actions": "^7.0.2",
|
|
70
|
+
"@storybook/addon-docs": "^7.0.2",
|
|
71
|
+
"@storybook/addon-essentials": "^7.0.2",
|
|
72
|
+
"@storybook/addon-interactions": "^7.0.2",
|
|
73
|
+
"@storybook/addon-links": "^7.0.2",
|
|
74
|
+
"@storybook/addon-mdx-gfm": "^7.0.2",
|
|
75
|
+
"@storybook/addon-storysource": "^7.0.2",
|
|
76
|
+
"@storybook/react": "^7.0.2",
|
|
77
|
+
"@storybook/react-vite": "^7.0.2",
|
|
78
78
|
"@types/react": "^18.0.28",
|
|
79
79
|
"@types/react-dom": "^18.0.11",
|
|
80
80
|
"@types/three": "^0.150.0",
|
|
81
81
|
"babel-loader": "^8.3.0",
|
|
82
|
+
"react": "^18.2.0",
|
|
83
|
+
"react-dom": "^18.2.0",
|
|
82
84
|
"rollup": "^3.20.0",
|
|
83
85
|
"rollup-plugin-copy": "^3.4.0",
|
|
84
86
|
"rollup-plugin-filesize": "^10.0.0",
|
|
87
|
+
"storybook": "^7.0.2",
|
|
85
88
|
"suspend-react": "^0.0.9",
|
|
86
89
|
"three": "^0.150.1"
|
|
87
90
|
},
|