Using views for the collision system

This commit is contained in:
Zoe Roux
2021-06-04 13:02:27 +02:00
parent 97add1b6d9
commit 181ccb7934
+1 -4
View File
@@ -32,12 +32,9 @@ namespace BBM
position += entity.getComponent<MovableComponent>().getVelocity();
Vector3f minA = Vector3f::min(position, position + col.bound);
Vector3f maxA = Vector3f::max(position, position + col.bound);
for (auto &other : _wal.scene->getEntities()) {
for (WAL::Entity &other : _wal.scene->view<PositionComponent, CollisionSystem>().entities) {
if (&other == &entity)
continue;
if (!other.hasComponent<CollisionComponent>() ||
!other.hasComponent<PositionComponent>())
continue;
auto colB = other.getComponent<CollisionComponent>();
auto posB = other.getComponent<PositionComponent>().position;
Vector3f minB = Vector3f::min(posB, posB + colB.bound);