X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fworld%2FWorld.cpp;fp=src%2Fworld%2FWorld.cpp;h=1e372e753d8c82257fb7bcd34fe6295c11e70e78;hb=f417749fb09718cde2faad77e8430cf175c68374;hp=3d3eb6c3d9ba11a6aebc685e01480dca6b6e773f;hpb=82ec71079e4763f2b2d66c0c210e37df40c89034;p=blank.git diff --git a/src/world/World.cpp b/src/world/World.cpp index 3d3eb6c..1e372e7 100644 --- a/src/world/World.cpp +++ b/src/world/World.cpp @@ -99,9 +99,12 @@ bool World::Intersection(const Entity &e, std::vector &col) { AABB box = e.Bounds(); glm::mat4 M = e.Transform(player->ChunkCoords()); bool any = false; - // TODO: this only needs to check the chunks surrounding the entity's chunk position - // need find out if that is quicker than the rough chunk bounds test for (Chunk &cur_chunk : chunks.Loaded()) { + if (manhattan_radius(cur_chunk.Position() - e.ChunkCoords()) > 1) { + // chunk is not one of the 3x3x3 surrounding the entity + // since there's no entity which can extent over 16 blocks, they can be skipped + continue; + } if (cur_chunk.Intersection(box, M, cur_chunk.Transform(player->ChunkCoords()), col)) { any = true; }