physics.space.intersect_shape

Client

Queries the physics world for all colliders overlapping a given shape at a position — useful for explosion radius or area-of-effect checks


Syntax

local results = physics.space.intersect_shape(
    shape,
    position,
    options = {}
)

Parameters

TypeNameDescription
tableshapeShape descriptor table: {type = "box"/"sphere"/"capsule"/"cylinder", ...} with shape-specific fields such as size, radius, or height
vector3positionWorld-space position to test the shape at as {x, y, z}
tableoptionsOptional table with mask, exclude, max_results, margin, collide_bodies, and collide_areas fields

Returns

TypeNameDescription
tableresultsArray of tables, each with a collider field

Examples

Query colliders in a radius
local nearby = physics.space.intersect_shape(
    { type = "sphere", radius = 5 },
    explosion_position
)

for i, hit in ipairs(nearby) do
    core.engine.print("info", hit.collider)
end

On this page