Physics Query

Query the physics world with a raycast, shape cast, closest-point, or overlap test.

What it does

Asks a live Physics World a spatial question and returns numbers, not geometry. It can cast a ray, sweep a shape, find the closest surface to a point, or count what overlaps a region. It reads against the same collider shapes (ball, box, capsule, cylinder) the physics solver uses, so what it reports matches what the simulation sees.

Results come out as plain values: whether it hit, where, the surface normal, the distance, which body it hit, how many colliders it found, and whether the origin started out already inside something. Wire those into an Expression, a trigger, or a transform.

When to use it

ParameterTypeDefault
world_idString"default"
query_typeString"Raycast"
origin_xNumber0
origin_yNumber100
origin_zNumber0
direction_xNumber0
direction_yNumber-1
direction_zNumber0
max_distanceNumber1000
query_shapeString"Ball"
query_radiusNumber5
query_half_xNumber5
query_half_yNumber5
query_half_zNumber5
opacityNumber1

Gotchas

World ID has to match the identifier used by the Physics World node feeding this query. When nothing hits, check that first.

Query Type and Query Shape are typed in as plain text (Raycast, ShapeCast, PointQuery, Overlap, and Ball, Cuboid for the shape). There is no dropdown yet, so match the spelling exactly.

Direction matters for Raycast and ShapeCast only. PointQuery and Overlap ignore it and use the origin position. The default direction points straight down, which suits ground checks and is easy to forget about for other query types.

Worked example

  1. Add a Physics Query and set World ID to match the Physics World node.

  2. Set Query Type to Raycast, place Origin above the scene, and leave Direction pointing down to cast toward the ground.

  3. Read Hit and Hit Distance downstream to drive a landing effect, or wire Hit Point / Hit Normal into a transform to align something to the surface.

  4. Switch Query Type to Overlap, set Query Shape to Ball, and raise Query Radius to instead count everything within reach of a point via Hit Count.

See also

Physics World · Collision Detect · Trigger · Scene values