void manCol() { circ.getParent()->setPosition(Vec2{ getMouseX(), getMouseY() }); color = clr_MAGENTA; drawCollider(circ); color = clr_CYAN; drawCollider(pent); CollisionData blerg = pent.collided(circ); if (blerg.collided) { color = clr_GREEN; cout << blerg.depth << endl; } else { color = clr_RED; } drawVector(circ.getClosestPointTo(pent.getParent()), circ.getParent()->getPosition()); }
void autoCol() { for (float x = 200; x < 300; x++) { for (float y = 200; y < 300; y++) { circ.getParent()->setPosition(Vec2{ x, y }); if (pent.collided(circ).collided) { color = clr_WHITE; drawVector(Vec2{ x, y }, Vec2{ x - 1, y - 1 }); } } } color = clr_RED; drawCollider(pent); }
void drawCollider(CircleCollider &c) { Vec2 blerg = c.getParent()->getPosition(); drawCircle(blerg.x, blerg.y, c.getRadius(), 15, color); }