From: Daniel Karbach Date: Mon, 9 Nov 2015 08:05:31 +0000 (+0100) Subject: fix entity/world collision X-Git-Url: https://git.localhorst.tv/?a=commitdiff_plain;h=3b2fe22c33074664b0c4f24be374e4e6c1c0ed2f;p=blank.git fix entity/world collision friday afternoon not good for me brain it seems --- diff --git a/src/world/chunk.cpp b/src/world/chunk.cpp index 4790f28..cc305cd 100644 --- a/src/world/chunk.cpp +++ b/src/world/chunk.cpp @@ -19,9 +19,6 @@ #include #include -#include -#include - namespace blank { @@ -460,12 +457,6 @@ bool Chunk::Intersection( return false; } - if (entity.ID() == 1) { - std::cout << "chunk: " << (Position() * 16) << ", entity: " << entity.AbsolutePosition() << std::endl; - std::cout << "\tMentity[3]: " << Mentity[3] << std::endl; - std::cout << "\tMchunk[3]: " << Mentity[3] << std::endl; - } - bool any = false; float penetration; glm::vec3 normal; @@ -479,11 +470,11 @@ bool Chunk::Intersection( RoughLocation::Fine(floor(entity_coords - eb_radius)) )); const RoughLocation::Fine end(min( - RoughLocation::Fine(side - 1), + RoughLocation::Fine(side), RoughLocation::Fine(ceil(entity_coords + eb_radius)) - ) - 1); + )); - for (RoughLocation::Fine pos(begin); pos.z < end.y; ++pos.z) { + for (RoughLocation::Fine pos(begin); pos.z < end.z; ++pos.z) { for (pos.y = begin.y; pos.y < end.y; ++pos.y) { for (pos.x = begin.x; pos.x < end.x; ++pos.x) { int idx = ToIndex(pos);