X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;ds=sidebyside;f=src%2Fshape%2FAABB.cpp;h=71844e8c178d7e57d8c6987c16458d70231bc0a7;hb=8969939c458bda0a5a9c6ad2197e7600e4c71c86;hp=75007ecbd5b42d3e62e53dbc84130995f7975098;hpb=8b4877fe48d21d7e789cf52f81c1d6a87b06bcbc;p=sdl-test8.git diff --git a/src/shape/AABB.cpp b/src/shape/AABB.cpp index 75007ec..71844e8 100644 --- a/src/shape/AABB.cpp +++ b/src/shape/AABB.cpp @@ -17,12 +17,16 @@ void AABB::Translate(const Vector &delta) { } void AABB::Rotate(Scalar delta) { - + // by definition AABBs cannot rotate } bool AABB::CheckCollision(const Shape &other, Ray &na) const { + // This call reveals the real type of this shape by overloading and the + // other one via polymorphism. if (other.CheckCollision(*this, na)) { + // Since the other shape's collision check returns its own surface + // normal, it has to be inverted here. na.Direction() *= -1; return true; } else {