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.
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new Physics3DQueries(
module_,ppu_,characters_?):Physics3DQueries
Defined in: physics3d/Physics3DQueries.ts:42
Parameters
Section titled “Parameters”module_
Section titled “module_”number
characters_?
Section titled “characters_?”ReadonlyMap<number, number> = ...
Returns
Section titled “Returns”Physics3DQueries
Methods
Section titled “Methods”overlapBox()
Section titled “overlapBox()”overlapBox(
centre,halfExtents,layerMask?):Overlap3DHit[]
Defined in: physics3d/Physics3DQueries.ts:100
The same for a box, given its half-extents.
Parameters
Section titled “Parameters”centre
Section titled “centre”number
number
number
halfExtents
Section titled “halfExtents”number
number
number
layerMask?
Section titled “layerMask?”number = 0
Returns
Section titled “Returns”overlapSphere()
Section titled “overlapSphere()”overlapSphere(
centre,radius,layerMask?):Overlap3DHit[]
Defined in: physics3d/Physics3DQueries.ts:91
Every body overlapping a sphere — what a spawn point asks before it spawns.
Parameters
Section titled “Parameters”centre
Section titled “centre”number
number
number
radius
Section titled “radius”number
layerMask?
Section titled “layerMask?”number = 0
Returns
Section titled “Returns”raycast()
Section titled “raycast()”raycast(
origin,direction,layerMask?):Cast3DHit|null
Defined in: physics3d/Physics3DQueries.ts:63
The nearest body along a ray, or null. direction carries its length.
Parameters
Section titled “Parameters”origin
Section titled “origin”number
number
number
direction
Section titled “direction”number
number
number
layerMask?
Section titled “layerMask?”number = 0
Returns
Section titled “Returns”Cast3DHit | null
sphereCast()
Section titled “sphereCast()”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”.
Parameters
Section titled “Parameters”origin
Section titled “origin”number
number
number
radius
Section titled “radius”number
direction
Section titled “direction”number
number
number
layerMask?
Section titled “layerMask?”number = 0
Returns
Section titled “Returns”Cast3DHit | null
teleportCharacter()
Section titled “teleportCharacter()”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.
Parameters
Section titled “Parameters”entity
Section titled “entity”number
position
Section titled “position”number
number
number
Returns
Section titled “Returns”boolean