RecastJSCrowd

Recast detour crowd implementation

Hierarchy

  • RecastJSCrowd

Implements

Index

Constructors

constructor

Find examples in Playground
  • Constructor

    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

Properties

agents

Find examples in Playground
agents: number[]

All agents created

bjsRECASTPlugin

Find examples in Playground
bjsRECASTPlugin: RecastJSPlugin

Recast/detour plugin

recastCrowd

Find examples in Playground
recastCrowd: any

Link to the detour crowd

transforms

Find examples in Playground
transforms: TransformNode[]

One transform per agent

Methods

addAgent

Find examples in Playground
  • 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

agentGoto

Find examples in Playground
  • agentGoto(index: number, destination: Vector3): void
  • 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

dispose

Find examples in Playground
  • dispose(): void
  • Release all resources

    Returns void

getAgentPosition

Find examples in Playground
  • getAgentPosition(index: number): Vector3
  • Returns the agent position in world space

    Parameters

    • index: number

      agent index returned by addAgent

    Returns Vector3

    world space position

getAgentVelocity

Find examples in Playground
  • getAgentVelocity(index: number): Vector3
  • Returns the agent velocity in world space

    Parameters

    • index: number

      agent index returned by addAgent

    Returns Vector3

    world space velocity

getAgents

Find examples in Playground
  • getAgents(): number[]
  • get the list of all agents attached to this crowd

    Returns number[]

    list of agent indices

removeAgent

Find examples in Playground
  • removeAgent(index: number): void
  • remove a particular agent previously created

    Parameters

    • index: number

      agent index returned by addAgent

    Returns void

update

Find examples in Playground
  • update(deltaTime: number): void
  • Tick update done by the Scene. Agent position/velocity/acceleration is updated by this function

    Parameters

    • deltaTime: number

      in seconds

    Returns void

Generated using TypeDoc