跳转到内容

NavMesh

此内容尚不支持你的语言。

Defined in: ai/nav/NavMesh.ts:77

The active navigable world, however it was built.

new NavMesh(data): NavMesh

Defined in: ai/nav/NavMesh.ts:107

NavMeshData

NavMesh

readonly agentRadius: number

Defined in: ai/nav/NavMesh.ts:86


readonly areas: Uint8Array

Defined in: ai/nav/NavMesh.ts:89


readonly maxVertsPerPoly: number

Defined in: ai/nav/NavMesh.ts:85


readonly neis: Int32Array

Defined in: ai/nav/NavMesh.ts:83


readonly polyCount: number

Defined in: ai/nav/NavMesh.ts:84


readonly polys: Int32Array

Defined in: ai/nav/NavMesh.ts:82


readonly snapDistance: number

Defined in: ai/nav/NavMesh.ts:87


readonly up: Vec3

Defined in: ai/nav/NavMesh.ts:79

The mesh follows the ground, so off it is straight up.

NavSurface.up


readonly verticalReach: number

Defined in: ai/nav/NavMesh.ts:88


readonly verts: Float32Array

Defined in: ai/nav/NavMesh.ts:81

get linkCount(): number

Defined in: ai/nav/NavMesh.ts:203

How many links this mesh carries, counting each direction of a two-way one.

number

connect(segments): void

Defined in: ai/nav/NavMesh.ts:186

Join places the ground does not. Each segment is resolved to the polygons under its two ends; one that reaches no ground at either end joins nothing and is dropped, because a link to nowhere is a route that ends in the air.

readonly NavLinkSegment[]

void


contains(p, x, z): boolean

Defined in: ai/nav/NavMesh.ts:233

Whether (x, z) is inside polygon p, seen from above.

number

number

number

boolean


corner(p, i, out): Vec3

Defined in: ai/nav/NavMesh.ts:224

World position of polygon p’s corner i, written into out.

number

number

Vec3

Vec3


costOf(p): number

Defined in: ai/nav/NavMesh.ts:177

What crossing polygon p costs a unit of distance.

number

number


describe(sink): void

Defined in: ai/nav/NavMesh.ts:584

Hand the shape of the walkable world to a drawer.

NavSurfaceSink

void

NavSurface.describe


findPoly(p, out?, snap?): number

Defined in: ai/nav/NavMesh.ts:284

The polygon a world point stands on, or -1. A point over more than one — under a bridge, on a balcony — belongs to the floor nearest its own height, which is the whole reason this mesh exists. snap overrides how far off the mesh the point may be, for a caller that has its own idea of near.

NavPoint

Vec3

number

number


findWorldPath(from, to, opts?): Vec3[] | null

Defined in: ai/nav/NavMesh.ts:354

Plan a world-space route between two world points, or null when there is no way. The waypoints carry all three axes: on a flat surface the third is the plane the scene is drawn on, on a spatial one it is the ground the route walks over.

NavPoint

NavPoint

NavQueryOptions

Vec3[] | null

NavSurface.findWorldPath


heightAt(p, x, z): number

Defined in: ai/nav/NavMesh.ts:256

Height of polygon p at (x, z). A convex polygon is not flat — its corners came off a voxel grid — so the answer comes from the triangle of the fan that covers the point, and from the nearest corner when the point is outside every one of them.

number

number

number

number


isNavigable(p): boolean

Defined in: ai/nav/NavMesh.ts:580

Whether an agent may stand at a world point. Asked of a place the agent has not been routed to — a step sideways to get round another body — which is why it is not the same question as “is there a route here”.

NavPoint

boolean

NavSurface.isNavigable


setAreaCost(area, cost): void

Defined in: ai/nav/NavMesh.ts:171

Say what an area costs to cross, against 1 for open ground. Cheap makes a route prefer it and dear makes it go round; nothing here BLOCKS, because a price an agent will not pay when there is another way is still a price it pays when there is not.

number

number

void


vertexCount(p): number

Defined in: ai/nav/NavMesh.ts:215

How many corners polygon p actually has.

number

number