World:overlapShape

Edit

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:

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.





Arguments

NameTypeDefaultDescription
shapeShape The Shape to test.
xnumber The x position to place the shape at, in meters.
ynumber The y position to place the shape at, in meters.
znumber The z position to place the shape at, in meters.
anglenumber The angle the shape is rotated around its rotation axis, in radians.
axnumber The x component of the axis of rotation.
aynumber The y component of the axis of rotation.
aznumber The z component of the axis of rotation.
filterstringnil Tags to filter by, or nil for no filter.
callbackfunction The callback to call for each intersection detected.

Returns

Nothing

Arguments

NameTypeDefaultDescription
shapeShape The Shape to test.
positionVec3 The position to place the shape at, in meters.
orientationQuat The orientation of the shape.
filterstringnil Tags to filter by, or nil for no filter.
callbackfunction The callback to call for each intersection detected.

Returns

Nothing

Arguments

NameTypeDefaultDescription
shapeShape The Shape to test.
xnumber The x position to place the shape at, in meters.
ynumber The y position to place the shape at, in meters.
znumber The z position to place the shape at, in meters.
anglenumber The angle the shape is rotated around its rotation axis, in radians.
axnumber The x component of the axis of rotation.
aynumber The y component of the axis of rotation.
aznumber The z component of the axis of rotation.
filterstringnil Tags to filter by, or nil for no filter.

Returns

NameTypeDescription
colliderCollider The collider that was hit.
shapeShape The shape that was hit.
xnumber The x position of a world space contact point on the surface of the shape.
ynumber The y position of a world space contact point on the surface of the shape.
znumber The z position of a world space contact point on the surface of the shape.
nxnumber The x component of the penetration vector.
nynumber The y component of the penetration vector.
nznumber The z component of the penetration vector.

Arguments

NameTypeDefaultDescription
shapeShape The Shape to test.
positionVec3 The position to place the shape at, in meters.
orientationQuat The orientation of the shape.
filterstringnil Tags to filter by, or nil for no filter.

Returns

NameTypeDescription
colliderCollider The collider that was hit.
shapeShape The shape that was hit.
xnumber The x position of a world space contact point on the surface of the shape.
ynumber The y position of a world space contact point on the surface of the shape.
znumber The z position of a world space contact point on the surface of the shape.
nxnumber The x component of the penetration vector.
nynumber The y component of the penetration vector.
nznumber The z component of the penetration vector.

See also