Matter.Query
Defined in: src/collision/Query.js:1
The Matter.Query
module contains methods for performing collision queries.
See the included usage examples.
Methods
Matter.Query.collides
(body, bodies)
→ Object[]
Returns a list of collisions between body
and bodies
.
Parameters
body
Body
bodies
Body[]
Returns
Object[]Collisions
Matter.Query.point
(bodies, point)
→ Body[]
Returns all bodies whose vertices contain the given point, from the given set of bodies.
Parameters
bodies
Body[]
point
Vector
Returns
Body[]The bodies matching the query
Matter.Query.ray
(bodies, startPoint, endPoint, [rayWidth])
→ Object[]
Casts a ray segment against a set of bodies and returns all collisions, ray width is optional. Intersection points are not provided.
Parameters
bodies
Body[]
startPoint
Vector
endPoint
Vector
[rayWidth]
Numberoptional
Returns
Object[]Collisions
Matter.Query.region
(bodies, bounds, [outside=false])
→ Body[]
Returns all bodies whose bounds are inside (or outside if set) the given set of bounds, from the given set of bodies.
Parameters
bodies
Body[]
bounds
Bounds
[outside=false]
Booloptional
Returns
Body[]The bodies matching the query