Skip to content

Instantly share code, notes, and snippets.

View wldomiciano's full-sized avatar

Wellington Domiciano wldomiciano

View GitHub Profile
@eliasdaler
eliasdaler / OBB.cpp
Last active October 26, 2023 20:14
OBB collision check and resolution using SAT (SFML, 2D)
// SAT collision check and resolution
// Public domain
// Usage example:
// if (testCollision(obb1, obb2, mtv)) { // obb1, obb2 - sf::RectangleShape, mtv - sf::Vector2f
// obb1.move(mtv);
// }
static const float NORMAL_TOLERANCE = 0.0001f;
using RectVertexArray = std::array<sf::Vector2f, 4>;