API

Interface INavigationEnginePlugin

Navigation plugin interface to add navigation constrained by a navigation mesh

interface INavigationEnginePlugin {
    name: string;
    addBoxObstacle(
        position: Vector3,
        extent: Vector3,
        angle: number,
    ): Nullable<IObstacle>;
    addCylinderObstacle(
        position: Vector3,
        radius: number,
        height: number,
    ): Nullable<IObstacle>;
    buildFromNavmeshData(data: Uint8Array): void;
    computePath(start: Vector3, end: Vector3): Vector3[];
    computePathSmooth(start: Vector3, end: Vector3): Vector3[];
    createCrowd(
        maxAgents: number,
        maxAgentRadius: number,
        scene: Scene,
    ): ICrowd;
    createDebugNavMesh(scene: Scene): Mesh;
    createNavMesh(meshes: Mesh[], parameters: INavMeshParameters): void;
    dispose(): void;
    getClosestPoint(position: Vector3): Vector3;
    getClosestPointToRef(position: Vector3, result: Vector3): void;
    getDefaultQueryExtent(): Vector3;
    getDefaultQueryExtentToRef(result: Vector3): void;
    getMaximumSubStepCount(): number;
    getNavmeshData(): Uint8Array;
    getRandomPointAround(position: Vector3, maxRadius: number): Vector3;
    getRandomPointAroundToRef(
        position: Vector3,
        maxRadius: number,
        result: Vector3,
    ): void;
    getTimeStep(): number;
    isSupported(): boolean;
    moveAlong(position: Vector3, destination: Vector3): Vector3;
    moveAlongToRef(
        position: Vector3,
        destination: Vector3,
        result: Vector3,
    ): void;
    removeObstacle(obstacle: IObstacle): void;
    setDefaultQueryExtent(extent: Vector3): void;
    setMaximumSubStepCount(newStepCount: number): void;
    setTimeStep(newTimeStep: number): void;
}

Implemented by

Index
name: string

plugin name

  • Create a new Crowd so you can add agents

    Parameters

    • 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 ICrowd

    the crowd you can add agents to

  • Get a navigation mesh constrained position, within a particular radius

    Parameters

    • position: Vector3

      world position

    • maxRadius: number

      the maximum distance to the constrained world position

    • result: Vector3

      output the closest point to position constrained by the navigation mesh

    Returns 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

  • 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

      the maximum number of iterations

    Returns void

  • 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