CollisionSystem loops over Collidable components.

This commit is contained in:
William Moberg
2016-01-18 13:29:10 +01:00
parent 942064c450
commit 0669d91767
2 changed files with 3 additions and 5 deletions
+1 -1
View File
@@ -15,7 +15,7 @@ class CollisionSystem : public PureSystem
public: public:
CollisionSystem(EventBroker* eventBroker, Octree* octree) CollisionSystem(EventBroker* eventBroker, Octree* octree)
: System(eventBroker) : System(eventBroker)
, PureSystem("AABB") , PureSystem("Collidable")
, m_Octree(octree) , m_Octree(octree)
, zPress(false) , zPress(false)
{ {
+2 -4
View File
@@ -30,10 +30,8 @@ void CollisionSystem::UpdateComponent(World* world, EntityWrapper& entity, Compo
continue; continue;
} }
if (Collision::AABBVsAABB(boxA, boxB, resolutionVector)) { if (Collision::AABBVsAABB(boxA, boxB, resolutionVector)) {
if (entity.HasComponent("Physics")) { (glm::vec3&)cTransform["Position"] += resolutionVector;
(glm::vec3&)cTransform["Position"] += resolutionVector; cPhysics["Velocity"] = glm::vec3(0, 0, 0);
cPhysics["Velocity"] = glm::vec3(0, 0, 0);
}
} }
} }