Space Query

physics.space.intersect_point

Shared

Queries the physics world for all colliders overlapping an exact world-space point

Syntax

local results = physics.space.intersect_point(
    point,
    options = {}
)

Parameters

TypeNameDescription
vector3pointWorld-space point to query as {x, y, z}
tableoptionsOptional query options table
Refer Options section

Returns

TypeNameDescription
tableresultsArray of tables, each with a collider field

Options

All fields are optional and fall back to their defaults if not specified.

TypeKeyDefaultSideDescription
intmask4294967295SharedCollision layers to test against, as a bitmask
The default matches every layer
tableexclude{}SharedArray of entities to ignore
Only physics bodies and areas are accepted, any other value is skipped
intmax_results32SharedMaximum number of colliders returned
boolcollide_bodiestrueShared• When true - physics bodies are tested
• When false - physics bodies are ignored
boolcollide_areasfalseShared• When true - areas are tested
• When false - areas are ignored
intdimension0SharedDimension whose physics world is queried, from 0 to 65535
• Anything outside this range raises an error
• A dimension with nothing in it simply finds nothing

Examples

Query colliders at a point
local results = physics.space.intersect_point({0, 1, 0})

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

On this page