Instance Method

enumerateBodiesAlongRayStart:end:usingBlock:

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

Declaration

- (void)enumerateBodiesAlongRayStart:(CGPoint)start end:(CGPoint)end usingBlock:(void (^)(SKPhysicsBody *body, CGPoint point, CGVector normal, BOOL *stop))block;

Parameters

start

The starting point for the ray in scene coordinates.

end

The ending point for the ray in scene coordinates.

block

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

body

The physics body that the ray intersected.

point

The point in scene coordinates where the ray contacted the physics body.

normal

The normal vector for the physics body at the point of contact.

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.

- enumerateBodiesAtPoint:usingBlock:

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

- enumerateBodiesInRect:usingBlock:

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