Places a shape in the World, returning any shapes it intersects.
A tag filter can be given to filter out shapes by their collider's tag:
Use nil to skip filtering.
Pass a tag name to only return shapes whose collider has that tag.
Pass a tag name with a ~ in front of it to exclude colliders with that tag.
Pass multiple tags separated by spaces to include multiple tags (works with ~ too).
Provide an optional callback to call for each shape detected. If the callbacks nil, this function returns the first shape detected. In either case this function returns the shape, the hit position, and a penetration vector. The penetration vector represents the direction and distance the shape would need to move so that it is no longer colliding with the input shape.
World:overlapShape(shape, x, y, z, angle, ax, ay, az, filter, callback)
World:overlapShape(shape, position, orientation, filter, callback)
collider, shape, x, y, z, nx, ny, nz = World:overlapShape(shape, x, y, z, angle, ax, ay, az, filter)
collider, shape, x, y, z, nx, ny, nz = World:overlapShape(shape, position, orientation, filter)
Arguments Name Type Default Description shape Shape
The Shape to test.
x number
The x position to place the shape at, in meters.
y number
The y position to place the shape at, in meters.
z number
The z position to place the shape at, in meters.
angle number
The angle the shape is rotated around its rotation axis, in radians.
ax number
The x component of the axis of rotation.
ay number
The y component of the axis of rotation.
az number
The z component of the axis of rotation.
filter string nil
Tags to filter by, or nil for no filter.
callback function
The callback to call for each intersection detected.
Returns Nothing
Arguments Name Type Default Description shape Shape
The Shape to test.
position Vec3
The position to place the shape at, in meters.
orientation Quat
The orientation of the shape.
filter string nil
Tags to filter by, or nil for no filter.
callback function
The callback to call for each intersection detected.
Returns Nothing
Arguments Name Type Default Description shape Shape
The Shape to test.
x number
The x position to place the shape at, in meters.
y number
The y position to place the shape at, in meters.
z number
The z position to place the shape at, in meters.
angle number
The angle the shape is rotated around its rotation axis, in radians.
ax number
The x component of the axis of rotation.
ay number
The y component of the axis of rotation.
az number
The z component of the axis of rotation.
filter string nil
Tags to filter by, or nil for no filter.
Returns Name Type Description collider Collider
The collider that was hit.
shape Shape
The shape that was hit.
x number
The x position of a world space contact point on the surface of the shape.
y number
The y position of a world space contact point on the surface of the shape.
z number
The z position of a world space contact point on the surface of the shape.
nx number
The x component of the penetration vector.
ny number
The y component of the penetration vector.
nz number
The z component of the penetration vector.
Arguments Name Type Default Description shape Shape
The Shape to test.
position Vec3
The position to place the shape at, in meters.
orientation Quat
The orientation of the shape.
filter string nil
Tags to filter by, or nil for no filter.
Returns Name Type Description collider Collider
The collider that was hit.
shape Shape
The shape that was hit.
x number
The x position of a world space contact point on the surface of the shape.
y number
The y position of a world space contact point on the surface of the shape.
z number
The z position of a world space contact point on the surface of the shape.
nx number
The x component of the penetration vector.
ny number
The y component of the penetration vector.
nz number
The z component of the penetration vector.
See also