-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Early version of the recast-navigation-js navigation plugin #16612
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
RolandCsibrei
wants to merge
4
commits into
BabylonJS:master
Choose a base branch
from
RolandCsibrei:recastnavplugin-v2
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,11 +2,12 @@ import type { TransformNode } from "../Meshes/transformNode"; | |
import type { Vector3 } from "../Maths/math"; | ||
import type { Mesh } from "../Meshes/mesh"; | ||
import type { Scene } from "../scene"; | ||
import type { IVector3Like } from "../Maths/math.like"; | ||
|
||
/** | ||
* Navigation plugin interface to add navigation constrained by a navigation mesh | ||
*/ | ||
export interface INavigationEnginePlugin { | ||
export interface INavigationEnginePlugin0 { | ||
/** | ||
* plugin name | ||
*/ | ||
|
@@ -17,7 +18,7 @@ export interface INavigationEnginePlugin { | |
* @param meshes array of all the geometry used to compute the navigation mesh | ||
* @param parameters bunch of parameters used to filter geometry | ||
*/ | ||
createNavMesh(meshes: Array<Mesh>, parameters: INavMeshParameters): void; | ||
createNavMesh(meshes: Array<Mesh>, parameters: INavMeshParameters0): void; | ||
|
||
/** | ||
* Create a navigation mesh debug mesh | ||
|
@@ -196,6 +197,106 @@ export interface INavigationEnginePlugin { | |
dispose(): void; | ||
} | ||
|
||
/** | ||
* | ||
*/ | ||
export interface INavigationEnginePlugin extends INavigationEnginePlugin0 { | ||
/** | ||
* | ||
*/ | ||
navMesh?: any; | ||
|
||
/** | ||
* | ||
*/ | ||
navMeshQuery: any; | ||
/** | ||
* | ||
*/ | ||
setWorker: (worker: Worker) => void; | ||
getClosestPoint( | ||
position: IVector3Like, | ||
options?: { | ||
/** | ||
* | ||
*/ | ||
halfExtents?: IVector3Like; | ||
} | ||
): Vector3; | ||
getClosestPointToRef( | ||
position: IVector3Like, | ||
result: Vector3, | ||
options?: { | ||
/** | ||
* | ||
*/ | ||
halfExtents?: IVector3Like; | ||
} | ||
): void; | ||
getRandomPointAround( | ||
position: IVector3Like, | ||
maxRadius: number, | ||
options?: { | ||
/** | ||
* | ||
*/ | ||
startRef?: number; | ||
/** | ||
* | ||
*/ | ||
halfExtents?: IVector3Like; | ||
} | ||
): Vector3; | ||
getRandomPointAroundToRef( | ||
position: IVector3Like, | ||
maxRadius: number, | ||
result: Vector3, | ||
options?: { | ||
/** | ||
* | ||
*/ | ||
startRef?: number; | ||
/** | ||
* | ||
*/ | ||
halfExtents?: IVector3Like; | ||
} | ||
): void; | ||
|
||
createNavMesh(meshes: Array<Mesh>, parameters: INavMeshParameters0, completion?: (navmeshData: Uint8Array) => void): void; | ||
createNavMeshWorker(meshes: Array<Mesh>, parameters: INavMeshParameters0, completion: (data?: Uint8Array) => void): void; | ||
computePathSmooth( | ||
start: Vector3, | ||
end: Vector3, | ||
options?: { | ||
/** | ||
* | ||
*/ | ||
halfExtents?: IVector3Like; | ||
|
||
/** | ||
* @default 256 | ||
*/ | ||
maxPathPolys?: number; | ||
|
||
/** | ||
* @default 2048 | ||
*/ | ||
maxSmoothPathPoints?: number; | ||
|
||
/** | ||
* @default 0.5 | ||
*/ | ||
stepSize?: number; | ||
|
||
/** | ||
* @default 0.01 | ||
*/ | ||
slop?: number; | ||
} | ||
): Vector3[]; | ||
} | ||
|
||
/** | ||
* Obstacle interface | ||
*/ | ||
|
@@ -392,7 +493,7 @@ export interface IAgentParameters { | |
/** | ||
* Configures the navigation mesh creation | ||
*/ | ||
export interface INavMeshParameters { | ||
export interface INavMeshParameters0 { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does it need a name change as members are just added? |
||
/** | ||
* The xz-plane cell size to use for fields. [Limit: > 0] [Units: wu] | ||
*/ | ||
|
@@ -472,6 +573,27 @@ export interface INavMeshParameters { | |
*/ | ||
tileSize?: number; | ||
|
||
/** | ||
* A hint to Recast for how many walkable surface layers might exist per tile | ||
* allowing better memory and performance tuning during navmesh generation. | ||
*/ | ||
expectedLayersPerTile?: number; | ||
|
||
/** | ||
* The hard limit on how many stacked walkable surfaces (layers) a tile can have. | ||
* If Recast finds more layers than maxLayers, tile generation may fail or lose data. | ||
* Use a higher value (e.g. 4–8) for complex multi-level scenes; 1–2 is fine for flat terrain. | ||
*/ | ||
maxLayers?: number; | ||
|
||
/** | ||
* If set to true, intermediate objects used during the generation process will be retained. | ||
* This is useful for debugging purposes or if you want to process the intermediate data in any other way. | ||
* For example you can use it to trace countours, calculate heightfields, etc. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are functions used to get contours, heightfields exposed by the plugin? |
||
* Defaults to false. | ||
*/ | ||
keepIntermediates?: boolean; | ||
|
||
/** | ||
* The size of the non-navigable border around the heightfield. | ||
*/ | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why extending INavigationEnginePlugin0 and not simply adding members/methods to INavigationEnginePlugin ?