Instance Method

bodyAlongRayStart:end:

Searches for the first physics body that intersects a ray.

Declaration

- (SKPhysicsBody *)bodyAlongRayStart:(CGPoint)start end:(CGPoint)end;

Parameters

start

The starting point for the ray in scene coordinates.

end

The ending point for the ray in scene coordinates.

Return Value

The first physics body discovered that intersects the ray. This may be any body along the ray; it is not guaranteed to be the closest physics body. If no body intersects the ray, this method returns nil.

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.

- 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.

- enumerateBodiesInRect:usingBlock:

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