fix: cheap fix for multiple impassable collision
This commit is contained in:
parent
04fd533811
commit
bcb4115fa0
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user