adding a little bit of cache

This commit is contained in:
Clément Le Bihan
2021-06-10 12:25:16 +02:00
parent 40a281cfe6
commit 0d8fbea27c
+2 -2
View File
@@ -25,6 +25,7 @@ namespace BBM
void CollisionSystem::onFixedUpdate(WAL::ViewEntity<PositionComponent, CollisionComponent> &entity)
{
unsigned int entityUid = entity->getUid();
auto &posA = entity.get<PositionComponent>();
auto &colA = entity.get<CollisionComponent>();
Vector3f pointA = posA.position + colA.positionOffset;
@@ -49,12 +50,11 @@ namespace BBM
Vector3f maxAz = Vector3f::max(pointAz, pointAz + colA.bound);
for (auto &[other, posB, colB] : this->getView()) {
if (other.getUid() == entity->getUid())
if (other.getUid() == entityUid)
continue;
auto pointB = posB.position + colB.positionOffset;
int collidedAxis = 0;
// TODO if B is also a movable we don't check with it's changing position
Vector3f minB = Vector3f::min(pointB, pointB + colB.bound);
Vector3f maxB = Vector3f::max(pointB, pointB + colB.bound);