fix: cheap fix for multiple impassable collision

This commit is contained in:
cha0s 2024-11-11 16:26:46 -06:00
parent 04fd533811
commit bcb4115fa0

View File

@ -104,6 +104,7 @@ export default class Collider extends Component {
const aabb = this.$$aabbs[j];
const otherAabb = other.aabbs[oj];
const {Position} = thisEntity;
const {lastX, lastY} = Position;
if (!intersects(
{
x0: aabb.x0 + Position.lastX,
@ -113,7 +114,8 @@ export default class Collider extends Component {
},
otherAabb,
)) {
Position.x = Position.lastX
Position.x = lastX;
Position.lastX = lastX;
}
else if (!intersects(
{
@ -124,11 +126,14 @@ export default class Collider extends Component {
},
otherAabb,
)) {
Position.y = Position.lastY
Position.y = lastY;
Position.lastY = lastY;
}
else {
Position.x = Position.lastX
Position.y = Position.lastY
Position.x = lastX;
Position.lastX = lastX;
Position.y = lastY;
Position.lastY = lastY;
}
break;
}