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

ParameterTypeDefaultWhat it does
world_idString"default"Physics world identifier
query_typeString"Raycast"Query type: Raycast, ShapeCast, PointQuery, Overlap
origin_xNumber0Query origin X
origin_yNumber100Query origin Y
origin_zNumber0Query origin Z
direction_xNumber0Direction X (Raycast/ShapeCast)
direction_yNumber-1Direction Y (Raycast/ShapeCast)
direction_zNumber0Direction Z (Raycast/ShapeCast)
max_distanceNumber1000Maximum query distance
query_shapeString"Ball"Shape for ShapeCast/Overlap: Ball, Cuboid
query_radiusNumber5Radius for Ball shape
query_half_xNumber5Half-extent X for Cuboid shape
query_half_yNumber5Half-extent Y for Cuboid shape
query_half_zNumber5Half-extent Z for Cuboid shape
opacityNumber1Layer opacity (0 = transparent, 1 = opaque). Editable, wirable, keyframable.

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