Instance Method

enumerateBodiesInRect:usingBlock:

Enumerates all the physics bodies in the scene that intersect the specified rectangle.

Declaration

- (void)enumerateBodiesInRect:(CGRect)rect usingBlock:(void (^)(SKPhysicsBody *body, BOOL *stop))block;

Parameters

rect

A rectangle in scene coordinates.

block

A block to be called for each physics body that contains the point. The block takes the following parameters:

body

The physics body that intersected the rectangle.

stop

A pointer to a Boolean variable. Your block can set this to YES to terminate the enumeration.

See Also

Searching the Scene for Physics Bodies

Searching the World for Physics Bodies

Cast a ray to find the physics bodies in the scene that intersect it.

- bodyAlongRayStart:end:

Searches for the first physics body that intersects a ray.

- bodyAtPoint:

Searches for the first physics body that contains a point.

- bodyInRect:

Searches for the first physics body that intersects the specified rectangle.

- enumerateBodiesAlongRayStart:end:usingBlock:

Enumerates all the physics bodies in the scene that intersect a ray.

- enumerateBodiesAtPoint:usingBlock:

Enumerates all the physics bodies in the scene that contain a point.