add particles collision detection

This commit is contained in:
MihailRis
2024-11-03 01:59:41 +03:00
parent 1974298c82
commit b944f257f7
7 changed files with 58 additions and 22 deletions
+3 -1
View File
@@ -15,7 +15,8 @@ Emitter::Emitter(
prototype(std::move(prototype)),
texture(texture),
spawnInterval(spawnInterval),
count(count) {
count(count),
behaviour() {
this->prototype.emitter = this;
}
@@ -37,6 +38,7 @@ void Emitter::update(float delta, std::vector<Particle>& particles) {
while (count && timer > spawnInterval) {
// spawn particle
Particle particle = prototype;
particle.emitter = this;
particle.position = position;
particle.velocity += glm::ballRand(1.0f) * explosion;
particles.push_back(std::move(particle));