X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fai%2Fai.cpp;h=5f5474b5f3320030e2f7e902badbb86c58328a79;hb=d2fa8ca97d291508ce3812fb052a8255d3190d00;hp=6b380e4d1027a8e7e2cc1cba11f5d1d24bb539e3;hpb=a34fbcb0581056bd464158acfa30289a3e2c2c2d;p=blank.git diff --git a/src/ai/ai.cpp b/src/ai/ai.cpp index 6b380e4..5f5474b 100644 --- a/src/ai/ai.cpp +++ b/src/ai/ai.cpp @@ -5,6 +5,7 @@ #include "../model/geometry.hpp" #include "../world/Entity.hpp" #include "../world/World.hpp" +#include "../world/WorldCollision.hpp" #include @@ -34,12 +35,9 @@ void Chaser::Update(int dt) { bool line_of_sight = true; // FIXME: this only works if target is in the reference chunk (which is true for the player) Ray aim{Target().Position() - diff, norm_diff}; - Chunk *chunk; - int blkid; - float distance; - glm::vec3 normal; - if (world.Intersection(aim, glm::mat4(1.0f), chunk, blkid, distance, normal)) { - line_of_sight = distance > dist; + WorldCollision coll; + if (world.Intersection(aim, glm::mat4(1.0f), coll)) { + line_of_sight = coll.depth > dist; } if (!line_of_sight) {