---
title: "enumerateBodies(alongRayStart:end:using:)"
framework: spritekit
role: symbol
role_heading: Instance Method
path: "spritekit/skphysicsworld/enumeratebodies(alongraystart:end:using:)"
---

# enumerateBodies(alongRayStart:end:using:)

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

## Declaration

```swift
func enumerateBodies(alongRayStart start: CGPoint, end: CGPoint, using block: @escaping (SKPhysicsBody, CGPoint, CGVector, UnsafeMutablePointer<ObjCBool>) -> Void)
```

## 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:

## Mentioned in

Searching the World for Physics Bodies

## See Also

### Searching the Scene for Physics Bodies

- [Searching the World for Physics Bodies](spritekit/searching-the-world-for-physics-bodies.md)
- [body(alongRayStart:end:)](spritekit/skphysicsworld/body(alongraystart:end:).md)
- [body(at:)](spritekit/skphysicsworld/body(at:).md)
- [body(in:)](spritekit/skphysicsworld/body(in:).md)
- [enumerateBodies(at:using:)](spritekit/skphysicsworld/enumeratebodies(at:using:).md)
- [enumerateBodies(in:using:)](spritekit/skphysicsworld/enumeratebodies(in:using:).md)
