X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fgeometry%2FAABB.cpp;fp=src%2Fgeometry%2FAABB.cpp;h=9ea60b59accbb08c6de4792b395e7a34e9695710;hb=403973e00a69339b9b382473ac514a845fb70ed5;hp=e40c69fc40daab3b0c5245606dd893eb4db98c9e;hpb=7f9fa3ab53fa3014054f7b68aef658ae90c4c21b;p=sdl-test7.git diff --git a/src/geometry/AABB.cpp b/src/geometry/AABB.cpp index e40c69f..9ea60b5 100644 --- a/src/geometry/AABB.cpp +++ b/src/geometry/AABB.cpp @@ -13,7 +13,11 @@ namespace geometry { bool AABB::Overlaps(const Shape &other, Vector &normal) const { + // This call reveals the real type of this shape by overloading and the + // other one via polymorphism. if (other.Overlaps(*this, normal)) { + // Since the other shape's Overlaps() returns its own surface normal, + // it has to be inverted here. normal *= -1; return true; } else {