diff --git a/src/Systems/ParticleSystem.cpp b/src/Systems/ParticleSystem.cpp index e62218d..7cdec83 100644 --- a/src/Systems/ParticleSystem.cpp +++ b/src/Systems/ParticleSystem.cpp @@ -34,21 +34,24 @@ void Systems::ParticleSystem::UpdateEntity(double dt, EntityID entity, EntityID } std::list::iterator it; - for(it = m_ParticleEmitter[entity].begin(); it != m_ParticleEmitter[entity].end(); it++) + for(it = m_ParticleEmitter[entity].begin(); it != m_ParticleEmitter[entity].end();) { EntityID particleID = it->ParticleID; auto particleComponent = m_World->GetComponent(particleID, "Particle"); double timeLived = glfwGetTime() - it->SpawnTime; if(timeLived > particleComponent->LifeTime) { + + m_World->RemoveEntity(particleID); m_ParticleEmitter[entity].erase(it); //std::cout<<"Removed dead particle..."<GetComponent(particleID, "Transform"); float speed = 10 * dt; @@ -113,6 +116,14 @@ void Systems::ParticleSystem::SpawnParticles(EntityID emitterID, float spawnCoun auto model = m_World->AddComponent(ent, "Model"); model->ModelFile = "Models/Placeholders/PhysicsTest/Cube.obj"; + /*auto physics = m_World->AddComponent(ent, "Physics"); + physics->Mass = 1; + + auto physicShape = m_World->AddComponent(ent, "Box"); + physicShape->Width = 0.5; + physicShape->Height = 0.5; + physicShape->Depth = 0.5;*/ + ParticleData data; data.ParticleID = ent; data.SpawnTime = glfwGetTime(); @@ -123,12 +134,13 @@ void Systems::ParticleSystem::SpawnParticles(EntityID emitterID, float spawnCoun m_ParticleEmitter[emitterID].push_back(data); } - std::cout<<"Added "<