pub type SCNParticleModifierBlock = *mut Block<dyn Fn(NonNull<NonNull<c_void>>, NonNull<usize>, NSInteger, NSInteger, c_float)>;SCNParticleSystem and block2 only.Expand description
Parameter data: array of particle properties data stripes, ordered by the given NSArray of properties name in [- handleEvent:forProperties:withBlock:]
Parameter dataStride: array of particle properties data stripes stride, with the same ordering than data.
Parameter start: index of the first particle
Parameter end: index of the last particle
Parameter deltaTime: duration of the simulation step, in seconds.
This is a small example of usage of a modifier block: [self.particleSystem addModifierForProperties: @ [SCNParticlePropertyPosition, SCNParticlePropertyVelocity] atStage:SCNParticleModifierStagePreCollision withBlock:^(void **data, size_t *dataStride, NSInteger start, NSInteger end, float deltaTime) { for (NSInteger i = start; i < end; ++i) { // SCNParticlePropertyPosition (float3) float *pos = (float *)((char *)data[0] + dataStride[0] * i); // SCNParticlePropertyVelocity (float3) float *vel = (float *)((char *)data[1] + dataStride[1] * i);
// change velocity and/or position // … } }];
See also Apple’s documentation