跳转到内容

Physics3DQueries

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

Defined in: physics3d/Physics3DQueries.ts:41

The 3D world’s spatial queries.

A layer mask of 0 means every layer: a caller that did not ask to filter is asking for everything, and answering “nothing” there would be a silent empty result for the commonest call.

new Physics3DQueries(module_, ppu_, characters_?): Physics3DQueries

Defined in: physics3d/Physics3DQueries.ts:42

Physics3DWasmModule

number

ReadonlyMap<number, number> = ...

Physics3DQueries

overlapBox(centre, halfExtents, layerMask?): Overlap3DHit[]

Defined in: physics3d/Physics3DQueries.ts:100

The same for a box, given its half-extents.

number

number

number

number

number

number

number = 0

Overlap3DHit[]


overlapSphere(centre, radius, layerMask?): Overlap3DHit[]

Defined in: physics3d/Physics3DQueries.ts:91

Every body overlapping a sphere — what a spawn point asks before it spawns.

number

number

number

number

number = 0

Overlap3DHit[]


raycast(origin, direction, layerMask?): Cast3DHit | null

Defined in: physics3d/Physics3DQueries.ts:63

The nearest body along a ray, or null. direction carries its length.

number

number

number

number

number

number

number = 0

Cast3DHit | null


sphereCast(origin, radius, direction, layerMask?): Cast3DHit | null

Defined in: physics3d/Physics3DQueries.ts:80

Sweeps a sphere along direction and returns the first body it meets.

What a ray cannot answer: a ray is infinitely thin, so it passes through the very gaps a moving body would not fit — “can this thing get there” is a different question from “is anything on this line”.

number

number

number

number

number

number

number

number = 0

Cast3DHit | null


teleportCharacter(entity, position): boolean

Defined in: physics3d/Physics3DQueries.ts:53

Put a character somewhere, rather than moving it there. Its position is an OUTPUT — the step writes it into Transform every frame — so this is the only way to say it, and the velocity is dropped with the move.

Answers false for an entity the world has no character for.

number

number

number

number

boolean