CollisionSystem loops over Collidable components.
This commit is contained in:
@@ -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)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user