<!--
{
  "availability" : [
    "iOS: 8.0.0 - 26.0.0",
    "iPadOS: 8.0.0 - 26.0.0",
    "macCatalyst: 13.1.0 - 26.0.0",
    "macOS: 10.8.0 - 26.0.0",
    "tvOS: 9.0.0 - 26.0.0",
    "visionOS: 1.0.0 - 26.0.0",
    "watchOS: 3.0.0 - 26.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "SceneKit",
  "identifier" : "/documentation/SceneKit/SCNParticleModifierBlock",
  "metadataVersion" : "0.1.0",
  "role" : "Type Alias",
  "symbol" : {
    "kind" : "Type Alias",
    "modules" : [
      "SceneKit"
    ],
    "preciseIdentifier" : "c:@T@SCNParticleModifierBlock"
  },
  "title" : "SCNParticleModifierBlock"
}
-->

# SCNParticleModifierBlock

The signature for blocks called by SceneKit to modify particle properties on each frame of simulation, used by the [`addModifier(forProperties:at:modifier:)`](/documentation/SceneKit/SCNParticleSystem/addModifier(forProperties:at:modifier:)) method.

```
typealias SCNParticleModifierBlock = (UnsafeMutablePointer<UnsafeMutableRawPointer>, UnsafeMutablePointer<Int>, Int, Int, Float) -> Void
```

## Discussion

The block takes the following parameters:

- data: An array of floating-point values containing stripes of property data for the system’s particles. The width and format of each data stripe depend on the properties you specify when calling the [`addModifier(forProperties:at:modifier:)`](/documentation/SceneKit/SCNParticleSystem/addModifier(forProperties:at:modifier:)) method.
- dataStride: An array identifying the offset, in bytes, of each property’s value in the data stripe for each particle. The order of offsets in this array corresponds to the order of the `properties` array you specify when calling the [`addModifier(forProperties:at:modifier:)`](/documentation/SceneKit/SCNParticleSystem/addModifier(forProperties:at:modifier:)) method.
- start: The index of the first particle’s data stripe in the `data` array.
- end: The index of the last particle’s data stripe in the `data` array.
- deltaTime: The elapsed time, in seconds, since the last frame of simulation.

Use this block to change properties of individual particles on each frame of simulation.

> Important:
> Running your own code to update particle properties every frame can have a severe impact on rendering performance. If the behavior over time that you want for your particle system can be described more declaratively, use the ``doc://com.apple.scenekit/documentation/SceneKit/SCNParticleSystem/propertyControllers`` property and ``doc://com.apple.scenekit/documentation/SceneKit/SCNParticlePropertyController`` class instead. If you need to change particle properties only at certain times (rather than continuously), add a handler block for an event using the ``doc://com.apple.scenekit/documentation/SceneKit/SCNParticleSystem/handle(_:forProperties:handler:)`` method.

The following example illustrates setting up a modifier block that alters particle’s position and velocity:

```objc
[system addModifierForProperties:@[SCNParticlePropertyPosition,
                                   SCNParticlePropertyVelocity]
                         atStage:SCNParticleModifierStagePostDynamics
                       withBlock:^(void **data, size_t *dataStride, NSInteger start, NSInteger end, float deltaTime) {
                           // For each particle to be processed,
                           // calculate pointers in the data to each property's value:
                           for (NSInteger i = start; i < end; ++i) {
                               // SCNParticlePropertyPosition (float3)
                               float *pos = (float *)((char *)data[0] + dataStride[0] * i);
                               // pos[0..2] are the xyz components of the particle's position.
 
                               // SCNParticlePropertyVelocity (float3)
                               float *vel = (float *)((char *)data[1] + dataStride[1] * i);
                               // vel[0..2] are the xyz components of the particle's position.
 
                               // Now, compute a new position and velocity (not shown).
                           }
                       }];
```

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)