Class RecastJSPlugin
Implements
Index
Constructors
Properties
Accessors
Methods
Constructors
constructor
-
Initializes the recastJS plugin
Parameters
- recastInjection: any = Recast
can be used to inject your own recast reference
Returns RecastJSPlugin
- recastInjection: any = Recast
Properties
bjs RECAST
Reference to the Recast library
name
plugin name
nav Mesh
the first navmesh created. We might extend this to support multiple navmeshes
Accessors
time Factor
-
get timeFactor(): number
Get the time factor used for crowd agent update
Returns number
the time factor
-
set timeFactor(value: number): void
Time factor applied when updating crowd agents (default 1). A value of 0 will pause crowd updates.
Parameters
- value: number
the time factor applied at update
Returns void
- value: number
Methods
add Box Obstacle
add Cylinder Obstacle
build From Navmesh Data
-
build the navmesh from a previously saved state using getNavmeshData
Parameters
- data: Uint8Array
the Uint8Array returned by getNavmeshData
Returns void
- data: Uint8Array
compute Path
compute Path Smooth
create Crowd
create Debug Nav Mesh
create Nav Mesh
-
Creates a navigation mesh
Parameters
- meshes: Mesh[]
array of all the geometry used to compute the navigation mesh
- parameters: INavMeshParameters
bunch of parameters used to filter geometry
Optionalcompletion: (navmeshData: Uint8Array) => voidcallback when data is available from the worker. Not used without a worker
Returns void
- meshes: Mesh[]
dispose
-
Disposes of the plugin resources
Returns void
get Closest Point
get Closest Point To Ref
get Default Query Extent
get Default Query Extent To Ref
-
Get the Bounding box extent result specified by setDefaultQueryExtent
Parameters
- result: Vector3
output the box extent values
Returns void
- result: Vector3
get Maximum Sub Step Count
-
Get the maximum number of iterations per navigation tick update
Returns number
the maximum number of iterations
get Navmesh Data
-
returns the navmesh data that can be used later. The navmesh must be built before retrieving the data
Returns Uint8Array
data the Uint8Array that can be saved and reused
get Random Point Around
get Random Point Around To Ref
get Random Seed
-
Returns the seed used for randomized functions like
getRandomPointAroundReturns number
seed number
get Time Step
-
Get the time step of the navigation tick update.
Returns number
the current time step
is Supported
-
If this plugin is supported
Returns boolean
true if plugin is supported
move Along
move Along To Ref
remove Obstacle
-
Removes an obstacle created by addCylinderObstacle or addBoxObstacle
Parameters
- obstacle: IObstacle
obstacle to remove from the navigation
Returns void
- obstacle: IObstacle
set Default Query Extent
-
Set the Bounding box extent for doing spatial queries (getClosestPoint, getRandomPointAround, ...) The queries will try to find a solution within those bounds default is (1,1,1)
Parameters
- extent: Vector3
x,y,z value that define the extent around the queries point of reference
Returns void
- extent: Vector3
set Maximum Sub Step Count
-
If delta time in navigation tick update is greater than the time step a number of sub iterations are done. If more iterations are needed to reach deltatime they will be discarded. A value of 0 will set to no maximum and update will use as many substeps as needed
Parameters
- newStepCount: number = 10
the maximum number of iterations
Returns void
- newStepCount: number = 10
set Random Seed
-
Set the seed used for randomized functions like
getRandomPointAroundParameters
- seed: number
number used as seed for random functions
Returns void
- seed: number
set Time Step
-
Set the time step of the navigation tick update. Default is 1/60. A value of 0 will disable fixed time update
Parameters
- newTimeStep: number = ...
the new timestep to apply to this world.
Returns void
- newTimeStep: number = ...
set Worker URL
-
Set worker URL to be used when generating a new navmesh
Parameters
- workerURL: string | URL
url string
Returns boolean
boolean indicating if worker is created
- workerURL: string | URL
RecastJS navigation plugin