---
title: "withParticleIndices(_:)"
framework: realitykit
role: symbol
role_heading: Instance Method
path: "realitykit/clothcolliderevents/newbodycollisions/collision/withparticleindices(_:)"
---

# withParticleIndices(_:)

Provides access to the indices of particles that collided with the collider.

## Declaration

```swift
func withParticleIndices<Result>(_ callback: (Span<UInt32>) -> Result) -> Result
```

## Parameters

- `callback`: A closure that receives a span over the colliding particle indices.

## Return Value

Return Value The value returned by callback.

## Discussion

Discussion This span is only available during the subscription callback of this event. The provided span is only valid for the lifetime of the callback.

## See Also

### Accessing affected particles

- [particleIndices](realitykit/clothcolliderevents/newbodycollisions/collision/particleindices.md)
