---
title: SCNParticleModifierBlock
framework: scenekit
role: symbol
role_heading: Type Alias
path: scenekit/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:) method.

## Declaration

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

## Discussion

Discussion The block takes the following parameters: 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 propertyControllers property and 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 handle(_:forProperties:handler:) method. The following example illustrates setting up a modifier block that alters particle’s position and velocity: [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).                            }                        }];

## See Also

### Modifying Particles Over Time

- [propertyControllers](scenekit/scnparticlesystem/propertycontrollers.md)
- [addModifier(forProperties:at:modifier:)](scenekit/scnparticlesystem/addmodifier(forproperties:at:modifier:).md)
- [removeModifiers(at:)](scenekit/scnparticlesystem/removemodifiers(at:).md)
- [removeAllModifiers()](scenekit/scnparticlesystem/removeallmodifiers().md)
- [SCNParticleSystem.ParticleProperty](scenekit/scnparticlesystem/particleproperty.md)
- [SCNParticleModifierStage](scenekit/scnparticlemodifierstage.md)
