@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 ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License
2
+
3
+ Copyright © 2022 Isaac Mason
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,3 @@
1
+ # @recast-navigation/core
2
+
3
+ This package contains the the core functionality for `recast-navigation`. Please refer to the [main package's README](https://github.com/isaac-mason/recast-navigation-js/tree/main/packages/recast-navigation/README.md) for usage information.
@@ -0,0 +1,103 @@
1
+ import R from '@recast-navigation/wasm';
2
+ import { NavMesh } from './nav-mesh';
3
+ import { NavPath, Vector3 } from './utils';
4
+ export declare type CrowdParams = {
5
+ maxAgents: number;
6
+ maxAgentRadius: number;
7
+ navMesh: NavMesh;
8
+ };
9
+ export declare type CrowdAgentParams = {
10
+ /**
11
+ * @default 0.5
12
+ */
13
+ radius: number;
14
+ /**
15
+ * @default 1
16
+ */
17
+ height: number;
18
+ /**
19
+ * @default 20
20
+ */
21
+ maxAcceleration: number;
22
+ /**
23
+ * @default 6
24
+ */
25
+ maxSpeed: number;
26
+ /**
27
+ * @default 2.5
28
+ */
29
+ collisionQueryRange: number;
30
+ /**
31
+ * @default 0
32
+ */
33
+ pathOptimizationRange: number;
34
+ /**
35
+ * @default 0
36
+ */
37
+ separationWeight: number;
38
+ /**
39
+ * @default 7
40
+ */
41
+ updateFlags: number;
42
+ /**
43
+ * @default 0
44
+ */
45
+ obstacleAvoidanceType: number;
46
+ /**
47
+ * @default 0
48
+ */
49
+ queryFilterType: number;
50
+ /**
51
+ * @default 0
52
+ */
53
+ userData: unknown;
54
+ };
55
+ export declare class Crowd {
56
+ raw: R.Crowd;
57
+ agents: number[];
58
+ /**
59
+ * The NavMesh the crowd is interacting with
60
+ */
61
+ navMesh: NavMesh;
62
+ /**
63
+ * If delta time in navigation tick update is greater than the time step
64
+ * a number of sub iterations are done. If more iterations are need to reach deltatime
65
+ * they will be discarded.
66
+ * A value of 0 will set to no maximum and update will use as many substeps as needed
67
+ */
68
+ maximumSubStepCount: number;
69
+ /**
70
+ * Get the time step of the navigation tick update.
71
+ */
72
+ timeStep: number;
73
+ /**
74
+ * Time factor applied when updating crowd agents (default 1). A value of 0 will pause crowd updates.
75
+ */
76
+ timeFactor: number;
77
+ constructor({ maxAgents, maxAgentRadius, navMesh }: CrowdParams);
78
+ addAgent(position: Vector3, crowdAgentParams: Partial<CrowdAgentParams>): number;
79
+ removeAgent(agentIndex: number): void;
80
+ goto(agentIndex: number, position: Vector3): void;
81
+ teleport(agentIndex: number, position: Vector3): void;
82
+ update(deltaTime: number): void;
83
+ destroy(): void;
84
+ /**
85
+ * Returns the maximum number of agents that can be managed by the crowd.
86
+ */
87
+ getAgentCount(): number;
88
+ /**
89
+ * Returns the number of active agents in the crowd.
90
+ */
91
+ getActiveAgentCount(): number;
92
+ getAgents(): number[];
93
+ getAgentPosition(agentIndex: number): Vector3;
94
+ getAgentVelocity(agentIndex: number): Vector3;
95
+ getAgentNextTargetPath(agentIndex: number): Vector3;
96
+ getAgentState(agentIndex: number): number;
97
+ getAgentCorners(agentIndex: number): NavPath;
98
+ getAgentParameters(agentIndex: number): CrowdAgentParams;
99
+ setAgentParameters(agentIndex: number, crowdAgentParams: Partial<CrowdAgentParams>): void;
100
+ updateAgentParameters(agentIndex: number, crowdAgentParams: Partial<CrowdAgentParams>): void;
101
+ getDefaultQueryExtent(): Vector3;
102
+ setDefaultQueryExtent(extent: Vector3): void;
103
+ }
@@ -0,0 +1,7 @@
1
+ import R from '@recast-navigation/wasm';
2
+ export declare class DebugNavMesh {
3
+ raw: R.DebugNavMesh;
4
+ positions: number[];
5
+ indices: number[];
6
+ constructor(debugNavMesh: R.DebugNavMesh);
7
+ }
@@ -0,0 +1,6 @@
1
+ export * from './crowd';
2
+ export * from './debug-nav-mesh';
3
+ export * from './nav-mesh';
4
+ export * from './obstacle';
5
+ export * from './raw';
6
+ export * from './utils';