Fixed physics wrong error message

This commit is contained in:
Stiffly
2015-10-08 11:04:35 +02:00
parent ef5882ffbf
commit 66feadfd04
2 changed files with 7 additions and 18 deletions
+3 -3
View File
@@ -200,7 +200,7 @@ public:
//ParticleTest //ParticleTest
/*{ {
auto Pe = m_World->CreateEntity(); auto Pe = m_World->CreateEntity();
auto transform = m_World->AddComponent<Components::Transform>(Pe); auto transform = m_World->AddComponent<Components::Transform>(Pe);
auto particleEmitter= m_World->AddComponent<Components::ParticleEmitter>(Pe); auto particleEmitter= m_World->AddComponent<Components::ParticleEmitter>(Pe);
@@ -228,10 +228,10 @@ public:
PtTransform->Position = transform->Position; PtTransform->Position = transform->Position;
PtSprite->SpriteFile = "Textures/Background.png"; PtSprite->SpriteFile = "Textures/Background.png";
PtParticle->LifeTime = 3.f; PtParticle->LifeTime = 3.f;
PtParticle->Flags = ParticleFlags::Type::powderParticle | ParticleFlags::Type::particleContactFilterParticle | ParticleFlags::Type::fixtureContactFilterParticle; PtParticle->Flags = static_cast<ParticleFlags::Type>(ParticleFlags::Type::Powder | ParticleFlags::Type::ParticleContactFilter | ParticleFlags::Type::FixtureContactFilter);
} }
m_World->CommitEntity(Pe); m_World->CommitEntity(Pe);
}*/ }
//TODO: Why does the ball not collide with these bricks? //TODO: Why does the ball not collide with these bricks?
//BottomBox //BottomBox
+4 -15
View File
@@ -303,23 +303,12 @@ void dd::Systems::PhysicsSystem::OnEntityCommit(EntityID entity)
void dd::Systems::PhysicsSystem::OnEntityRemoved(EntityID entity) void dd::Systems::PhysicsSystem::OnEntityRemoved(EntityID entity)
{ {
/* auto physics = m_World->GetComponent<Components::Physics>(entity);
if (physics == nullptr) {
return;
}*/
auto it = m_EntitiesToBodies.find(entity); auto it = m_EntitiesToBodies.find(entity);
if(it == m_EntitiesToBodies.end()) { if(it != m_EntitiesToBodies.end()) {
LOG_ERROR("Trying to remove non-exsisting body, Entity: %i", entity); it->second->GetWorld()->DestroyBody(it->second);
return; m_BodiesToEntities.erase(it->second);
m_EntitiesToBodies.erase(entity);
} }
//It told me I was removing a lot of objects, and I didn't need that information, so I commented it out.
//LOG_INFO("Removing entity %i", entity);
it->second->GetWorld()->DestroyBody(it->second);
m_BodiesToEntities.erase(it->second);
m_EntitiesToBodies.erase(entity);
//delete body;
} }