1 #include <bz/collision/particle_collision.h>
3 #include <bz/fx/particle_simulation_internal.h>
5 void bzCollisionPopulateParticles(BZCollisionSpaceID space
, BZParticleSimulationID simulation
, BZIdentifierHash tagHash
, float radiusMultiplier
) {
8 s
.type
= BZCollisionShapeTypeCircle
;
10 for (size_t i
= 0; i
< simulation
->maxParticles
; ++i
) {
11 float particleStartTicks
= simulation
->spawnTime
[i
];
12 float lifetime
= simulation
->lifetime
[i
];
13 if (particleStartTicks
+ lifetime
>= simulation
->time
) {
14 s
.circleOrigin
.x
= simulation
->positionX
[i
];
15 s
.circleOrigin
.y
= simulation
->positionY
[i
];
16 s
.circleRadius
= simulation
->size
[i
] * radiusMultiplier
;
17 bzCollisionAddBody(space
, BZCollisionBodyTypeSolid
, &s
, tagHash
, (void *)i
);