Class RecastJSCrowd
Implements
Index
Constructors
Properties
Methods
Constructors
constructor
-
new RecastJSCrowd(
plugin: RecastJSPlugin,
maxAgents: number,
maxAgentRadius: number,
scene: Scene,
): RecastJSCrowdConstructor
Parameters
- plugin: RecastJSPlugin
recastJS plugin
- maxAgents: number
the maximum agent count in the crowd
- maxAgentRadius: number
the maximum radius an agent can have
- scene: Scene
to attach the crowd to
Returns RecastJSCrowd
the crowd you can add agents to
- plugin: RecastJSPlugin
Properties
agents
All agents created
bjs RECAST Plugin
Recast/detour plugin
on Reach Target Observable
Fires each time an agent is in reach radius of its destination
reach Radii
agents reach radius
recast Crowd
Link to the detour crowd
transforms
One transform per agent
Methods
add Agent
-
Add a new agent to the crowd with the specified parameter a corresponding transformNode. You can attach anything to that node. The node position is updated in the scene update tick.
Parameters
- pos: Vector3
world position that will be constrained by the navigation mesh
- parameters: IAgentParameters
agent parameters
- transform: TransformNode
hooked to the agent that will be update by the scene
Returns number
agent index
- pos: Vector3
agent Goto
-
Asks a particular agent to go to a destination. That destination is constrained by the navigation mesh
Parameters
- index: number
agent index returned by addAgent
- destination: Vector3
targeted world position
Returns void
- index: number
agent Teleport
-
Teleport the agent to a new position
Parameters
- index: number
agent index returned by addAgent
- destination: Vector3
targeted world position
Returns void
- index: number
dispose
-
Release all resources
Returns void
get Agent Next Target Path
-
Returns the agent next target point on the path
Parameters
- index: number
agent index returned by addAgent
Returns Vector3
world space position
- index: number
get Agent Next Target Path To Ref
-
Returns the agent next target point on the path
Parameters
- index: number
agent index returned by addAgent
- result: Vector3
output world space position
Returns void
- index: number
get Agent Position
-
Returns the agent position in world space
Parameters
- index: number
agent index returned by addAgent
Returns Vector3
world space position
- index: number
get Agent Position To Ref
-
Returns the agent position result in world space
Parameters
- index: number
agent index returned by addAgent
- result: Vector3
output world space position
Returns void
- index: number
get Agents
-
get the list of all agents attached to this crowd
Returns number[]
list of agent indices
get Agent State
-
Gets the agent state
Parameters
- index: number
agent index returned by addAgent
Returns number
agent state
- index: number
get Agent Velocity
-
Returns the agent velocity in world space
Parameters
- index: number
agent index returned by addAgent
Returns Vector3
world space velocity
- index: number
get Agent Velocity To Ref
-
Returns the agent velocity result in world space
Parameters
- index: number
agent index returned by addAgent
- result: Vector3
output world space velocity
Returns void
- index: number
get Corners
-
Get the next corner points composing the path (max 4 points)
Parameters
- index: number
agent index returned by addAgent
Returns Vector3[]
array containing world position composing the path
- index: number
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
over Offmesh Connection
-
returns true if the agent in over an off mesh link connection
Parameters
- index: number
agent index returned by addAgent
Returns boolean
true if over an off mesh link connection
- index: number
remove Agent
-
remove a particular agent previously created
Parameters
- index: number
agent index returned by addAgent
Returns void
- index: number
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
update
-
Tick update done by the Scene. Agent position/velocity/acceleration is updated by this function
Parameters
- deltaTime: number
in seconds
Returns void
- deltaTime: number
update Agent Parameters
-
Update agent parameters
Parameters
- index: number
agent index returned by addAgent
- parameters: IAgentParameters
agent parameters
Returns void
- index: number
Recast detour crowd implementation