fix: emitter does not skip particles

This commit is contained in:
MihailRis 2024-11-09 21:54:30 +03:00
parent 82733d3801
commit 983e516fb4

View File

@ -64,6 +64,7 @@ void Emitter::update(
return;
}
}
timer += delta;
const float maxDistance = preset.maxDistance;
if (glm::distance2(position, cameraPosition) > maxDistance * maxDistance) {
if (count > 0) {
@ -77,7 +78,6 @@ void Emitter::update(
}
return;
}
timer += delta;
while (count && timer > spawnInterval) {
// spawn particle
Particle particle = prototype;