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
| Type | Name | Description |
|---|---|---|
table | shape | Shape descriptor table: {type = "box"/"sphere"/"capsule"/"cylinder", ...} with shape-specific fields such as size, radius, or height |
vector3 | position | World-space position to test the shape at as {x, y, z} |
table | options | Optional table with mask, exclude, max_results, margin, collide_bodies, and collide_areas fields |
Returns
| Type | Name | Description |
|---|---|---|
table | results | Array of tables, each with a collider field |
Examples
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