@recast-navigation/core 0.0.0-development-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/LICENSE +21 -0
- package/README.md +3 -0
- package/dist/crowd.d.ts +103 -0
- package/dist/debug-nav-mesh.d.ts +7 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.es.js +2 -0
- package/dist/index.es.js.map +1 -0
- package/dist/nav-mesh.d.ts +98 -0
- package/dist/obstacle.d.ts +1 -0
- package/dist/raw.d.ts +5 -0
- package/dist/utils.d.ts +22 -0
- package/package.json +58 -0
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import R from '@recast-navigation/wasm';
|
|
2
|
+
import { ObstacleRef } from './obstacle';
|
|
3
|
+
import { NavPath, Vector3 } from './utils';
|
|
4
|
+
import { DebugNavMesh } from './debug-nav-mesh';
|
|
5
|
+
import { Crowd } from './crowd';
|
|
6
|
+
export declare type NavMeshConfig = {
|
|
7
|
+
/**
|
|
8
|
+
* @default 0
|
|
9
|
+
*/
|
|
10
|
+
borderSize: number;
|
|
11
|
+
/**
|
|
12
|
+
* @default 0
|
|
13
|
+
*/
|
|
14
|
+
tileSize: number;
|
|
15
|
+
/**
|
|
16
|
+
* @default 0.2
|
|
17
|
+
*/
|
|
18
|
+
cs: number;
|
|
19
|
+
/**
|
|
20
|
+
* @default 0.2
|
|
21
|
+
*/
|
|
22
|
+
ch: number;
|
|
23
|
+
/**
|
|
24
|
+
* @default 60
|
|
25
|
+
*/
|
|
26
|
+
walkableSlopeAngle: number;
|
|
27
|
+
/**
|
|
28
|
+
* @default 2
|
|
29
|
+
*/
|
|
30
|
+
walkableHeight: number;
|
|
31
|
+
/**
|
|
32
|
+
* @default 2
|
|
33
|
+
*/
|
|
34
|
+
walkableClimb: number;
|
|
35
|
+
/**
|
|
36
|
+
* @default 0.5
|
|
37
|
+
*/
|
|
38
|
+
walkableRadius: number;
|
|
39
|
+
/**
|
|
40
|
+
* @default 12
|
|
41
|
+
*/
|
|
42
|
+
maxEdgeLen: number;
|
|
43
|
+
/**
|
|
44
|
+
* @default 1.3
|
|
45
|
+
*/
|
|
46
|
+
maxSimplificationError: number;
|
|
47
|
+
/**
|
|
48
|
+
* @default 8
|
|
49
|
+
*/
|
|
50
|
+
minRegionArea: number;
|
|
51
|
+
/**
|
|
52
|
+
* @default 20
|
|
53
|
+
*/
|
|
54
|
+
mergeRegionArea: number;
|
|
55
|
+
/**
|
|
56
|
+
* @default 6
|
|
57
|
+
*/
|
|
58
|
+
maxVertsPerPoly: number;
|
|
59
|
+
/**
|
|
60
|
+
* @default 6
|
|
61
|
+
*/
|
|
62
|
+
detailSampleDist: number;
|
|
63
|
+
/**
|
|
64
|
+
* @default 1
|
|
65
|
+
*/
|
|
66
|
+
detailSampleMaxError: number;
|
|
67
|
+
};
|
|
68
|
+
export declare class NavMesh {
|
|
69
|
+
raw: R.NavMesh;
|
|
70
|
+
constructor();
|
|
71
|
+
update(): void;
|
|
72
|
+
destroy(): void;
|
|
73
|
+
build(positions: ArrayLike<number>, indices: ArrayLike<number>, navMeshConfig?: Partial<NavMeshConfig>): void;
|
|
74
|
+
/**
|
|
75
|
+
* Build the navmesh from a previously saved state using getNavMeshData
|
|
76
|
+
* @param data the Uint8Array returned by `getNavMeshData`
|
|
77
|
+
*/
|
|
78
|
+
buildFromNavMeshData(data: Uint8Array): void;
|
|
79
|
+
/**
|
|
80
|
+
* Returns the NavMesh data that can be used later. The NavMesh must be built before retrieving the data
|
|
81
|
+
* @returns data the Uint8Array that can be saved and reused
|
|
82
|
+
*/
|
|
83
|
+
getNavMeshData(): Uint8Array;
|
|
84
|
+
getDebugNavMesh(): DebugNavMesh;
|
|
85
|
+
getClosestPoint(position: Vector3): Vector3;
|
|
86
|
+
getRandomPointAround(position: Vector3, radius: number): Vector3;
|
|
87
|
+
moveAlong(position: Vector3, destination: Vector3): Vector3;
|
|
88
|
+
computePath(start: Vector3, end: Vector3): NavPath;
|
|
89
|
+
getDefaultQueryExtent(): Vector3;
|
|
90
|
+
setDefaultQueryExtent(extent: Vector3): void;
|
|
91
|
+
addCylinderObstacle(position: Vector3, radius: number, height: number): ObstacleRef;
|
|
92
|
+
addBoxObstacle(position: Vector3, extent: Vector3, angle: number): ObstacleRef;
|
|
93
|
+
removeObstacle(obstacleRef: ObstacleRef): void;
|
|
94
|
+
createCrowd(config: {
|
|
95
|
+
maxAgents: number;
|
|
96
|
+
maxAgentRadius: number;
|
|
97
|
+
}): Crowd;
|
|
98
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare type ObstacleRef = unknown;
|
package/dist/raw.d.ts
ADDED
package/dist/utils.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type R from '@recast-navigation/wasm';
|
|
2
|
+
export declare type Vector3 = {
|
|
3
|
+
x: number;
|
|
4
|
+
y: number;
|
|
5
|
+
z: number;
|
|
6
|
+
};
|
|
7
|
+
export declare const vec3: {
|
|
8
|
+
toRaw: ({ x, y, z }: Vector3) => R.Vec3;
|
|
9
|
+
fromRaw: ({ x, y, z }: R.Vec3) => {
|
|
10
|
+
x: number;
|
|
11
|
+
y: number;
|
|
12
|
+
z: number;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
export declare type NavPath = Vector3[];
|
|
16
|
+
export declare const navPath: {
|
|
17
|
+
fromRaw: (v: R.NavPath) => {
|
|
18
|
+
x: number;
|
|
19
|
+
y: number;
|
|
20
|
+
z: number;
|
|
21
|
+
}[];
|
|
22
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@recast-navigation/core",
|
|
3
|
+
"description": "Recast Navigation for JavaScript!",
|
|
4
|
+
"author": {
|
|
5
|
+
"name": "Isaac Mason",
|
|
6
|
+
"email": "isaac@isaacmason.com",
|
|
7
|
+
"url": "https://isaacmason.com/"
|
|
8
|
+
},
|
|
9
|
+
"version": "0.0.0-development-0",
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"homepage": "https://github.com/isaac-mason/recast-navigation-js",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/isaac-mason/recast-navigation-js/issues"
|
|
14
|
+
},
|
|
15
|
+
"type": "module",
|
|
16
|
+
"main": "./dist/index.es.js",
|
|
17
|
+
"types": "./dist/index.d.ts",
|
|
18
|
+
"files": [
|
|
19
|
+
"dist/**",
|
|
20
|
+
"README.md",
|
|
21
|
+
"LICENSE"
|
|
22
|
+
],
|
|
23
|
+
"scripts": {
|
|
24
|
+
"build": "rollup --config rollup.config.js --bundleConfigAsCjs",
|
|
25
|
+
"test": "vitest run"
|
|
26
|
+
},
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"@recast-navigation/wasm": "0.0.0-development-0"
|
|
29
|
+
},
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"@babel/core": "^7.18.6",
|
|
32
|
+
"@rollup/plugin-commonjs": "^24.0.1",
|
|
33
|
+
"@rollup/plugin-node-resolve": "^15.0.1",
|
|
34
|
+
"@rollup/plugin-terser": "^0.4.0",
|
|
35
|
+
"@rollup/plugin-typescript": "^11.0.0",
|
|
36
|
+
"@types/three": "^0.150.0",
|
|
37
|
+
"@typescript-eslint/eslint-plugin": "^5.7.0",
|
|
38
|
+
"@typescript-eslint/parser": "^5.7.0",
|
|
39
|
+
"babel-loader": "^8.2.5",
|
|
40
|
+
"eslint": "^8.5.0",
|
|
41
|
+
"eslint-config-airbnb": "^18.2.1",
|
|
42
|
+
"eslint-config-airbnb-base": "^14.2.1",
|
|
43
|
+
"eslint-config-prettier": "^8.3.0",
|
|
44
|
+
"eslint-import-resolver-typescript": "^2.4.0",
|
|
45
|
+
"eslint-plugin-es": "^4.1.0",
|
|
46
|
+
"eslint-plugin-import": "^2.24.2",
|
|
47
|
+
"eslint-plugin-prettier": "^4.0.0",
|
|
48
|
+
"eslint-plugin-simple-import-sort": "^7.0.0",
|
|
49
|
+
"eslint-plugin-typescript-enum": "^2.1.0",
|
|
50
|
+
"prettier": "^2.3.2",
|
|
51
|
+
"rollup": "^3.20.0",
|
|
52
|
+
"rollup-plugin-copy": "^3.4.0",
|
|
53
|
+
"rollup-plugin-filesize": "^10.0.0",
|
|
54
|
+
"typescript": "^4.5.4",
|
|
55
|
+
"vitest": "^0.29.7"
|
|
56
|
+
},
|
|
57
|
+
"packageManager": "yarn@3.2.1"
|
|
58
|
+
}
|