Options
All
  • Public
  • Public/Protected
  • All
Menu

Class RecastJSCrowd

Recast detour crowd implementation

Hierarchy

  • RecastJSCrowd

Implements

Index

Constructors

constructor

  • 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

agentsSearch playground for agents

agents: number[]

All agents created

bjsRECASTPluginSearch playground for bjsRECASTPlugin

bjsRECASTPlugin: RecastJSPlugin

Recast/detour plugin

onReachTargetObservableSearch playground for onReachTargetObservable

onReachTargetObservable: Observable<{ agentIndex: number; destination: Vector3 }>

Fires each time an agent is in reach radius of its destination

reachRadiiSearch playground for reachRadii

reachRadii: number[]

agents reach radius

recastCrowdSearch playground for recastCrowd

recastCrowd: any

Link to the detour crowd

transformsSearch playground for transforms

transforms: TransformNode[]

One transform per agent

Methods

addAgentSearch playground for addAgent

  • 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

agentGotoSearch playground for agentGoto

  • 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

agentTeleportSearch playground for agentTeleport

  • agentTeleport(index: number, destination: Vector3): void
  • Teleport the agent to a new position

    Parameters

    • index: number

      agent index returned by addAgent

    • destination: Vector3

      targeted world position

    Returns void

disposeSearch playground for dispose

  • dispose(): void
  • Release all resources

    Returns void

getAgentNextTargetPathSearch playground for getAgentNextTargetPath

  • getAgentNextTargetPath(index: number): Vector3
  • Returns the agent next target point on the path

    Parameters

    • index: number

      agent index returned by addAgent

    Returns Vector3

    world space position

getAgentNextTargetPathToRefSearch playground for getAgentNextTargetPathToRef

  • getAgentNextTargetPathToRef(index: number, result: Vector3): void
  • 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

getAgentPositionSearch playground for getAgentPosition

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

    Parameters

    • index: number

      agent index returned by addAgent

    Returns Vector3

    world space position

getAgentPositionToRefSearch playground for getAgentPositionToRef

  • getAgentPositionToRef(index: number, result: Vector3): void
  • Returns the agent position result in world space

    Parameters

    • index: number

      agent index returned by addAgent

    • result: Vector3

      output world space position

    Returns void

getAgentStateSearch playground for getAgentState

  • getAgentState(index: number): number
  • Gets the agent state

    Parameters

    • index: number

      agent index returned by addAgent

    Returns number

    agent state

getAgentVelocitySearch playground for getAgentVelocity

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

    Parameters

    • index: number

      agent index returned by addAgent

    Returns Vector3

    world space velocity

getAgentVelocityToRefSearch playground for getAgentVelocityToRef

  • getAgentVelocityToRef(index: number, result: Vector3): void
  • Returns the agent velocity result in world space

    Parameters

    • index: number

      agent index returned by addAgent

    • result: Vector3

      output world space velocity

    Returns void

getAgentsSearch playground for getAgents

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

    Returns number[]

    list of agent indices

getCornersSearch playground for getCorners

  • getCorners(index: number): Vector3[]
  • 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

getDefaultQueryExtentSearch playground for getDefaultQueryExtent

  • Get the Bounding box extent specified by setDefaultQueryExtent

    Returns Vector3

    the box extent values

getDefaultQueryExtentToRefSearch playground for getDefaultQueryExtentToRef

  • getDefaultQueryExtentToRef(result: Vector3): void
  • Get the Bounding box extent result specified by setDefaultQueryExtent

    Parameters

    • result: Vector3

      output the box extent values

    Returns void

overOffmeshConnectionSearch playground for overOffmeshConnection

  • overOffmeshConnection(index: number): boolean
  • 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

removeAgentSearch playground for removeAgent

  • removeAgent(index: number): void
  • remove a particular agent previously created

    Parameters

    • index: number

      agent index returned by addAgent

    Returns void

setDefaultQueryExtentSearch playground for setDefaultQueryExtent

  • setDefaultQueryExtent(extent: Vector3): void
  • 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

updateSearch playground for update

  • 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

updateAgentParametersSearch playground for updateAgentParameters

  • Update agent parameters

    Parameters

    • index: number

      agent index returned by addAgent

    • parameters: IAgentParameters

      agent parameters

    Returns void

Legend

  • Constructor
  • Property
  • Method
  • Property
  • Method
  • Inherited property
  • Inherited method
  • Static property
  • Static method