mirror of
https://github.com/zoriya/Bomberman.git
synced 2026-05-28 08:33:36 +00:00
Using views for the collision system
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user