This commit is contained in:
Schluffe
2026-07-30 23:46:46 +02:00
parent ec9f2e2a2d
commit 3885c6dbb6
2 changed files with 53 additions and 4 deletions
+6 -2
View File
@@ -38,8 +38,12 @@ export function safeMoveAndSlide(box: AABB, v: Vec, walls: AABB[]): Vec {
for (const wall of walls) {
const pv = penetrationVector(box, wall);
if (pv) {
box.x += pv.x > 0 ? pv.x + EPSILON : pv.x - EPSILON;
box.y += pv.y > 0 ? pv.y + EPSILON : pv.y - EPSILON;
if (pv.x !== 0) {
box.x += pv.x > 0 ? pv.x + EPSILON : pv.x - EPSILON;
}
if (pv.y !== 0) {
box.y += pv.y > 0 ? pv.y + EPSILON : pv.y - EPSILON;
}
}
}