Space Query
physics.space.intersect_point
SharedQueries the physics world for all colliders overlapping an exact world-space point
Syntax
local results = physics.space.intersect_point(
point,
options = {}
)Parameters
| Type | Name | Description |
|---|---|---|
vector3 | point | World-space point to query as {x, y, z} |
table | options | Optional query options table Refer Options section |
Returns
| Type | Name | Description |
|---|---|---|
table | results | Array of tables, each with a collider field |
Options
All fields are optional and fall back to their defaults if not specified.
| Type | Key | Default | Side | Description |
|---|---|---|---|---|
int | mask | 4294967295 | Shared | Collision layers to test against, as a bitmask The default matches every layer |
table | exclude | {} | Shared | Array of entities to ignore Only physics bodies and areas are accepted, any other value is skipped |
int | max_results | 32 | Shared | Maximum number of colliders returned |
bool | collide_bodies | true | Shared | • When true - physics bodies are tested• When false - physics bodies are ignored |
bool | collide_areas | false | Shared | • When true - areas are tested• When false - areas are ignored |
int | dimension | 0 | Shared | Dimension 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
local results = physics.space.intersect_point({0, 1, 0})
for i, hit in ipairs(results) do
core.engine.print("info", hit.collider)
end