fix: always set last position

This commit is contained in:
cha0s 2024-11-17 03:44:14 -06:00
parent 7c976ad8c0
commit 9cfb06f66c

View File

@ -23,14 +23,14 @@ export default class IntegratePhysics extends System {
if (!Forces || !Position) {
return;
}
Position.lastX = Position.$$x;
Position.lastY = Position.$$y;
const xd = elapsed * (Forces.$$impulseX + Forces.$$forceX);
if (xd) {
Position.lastX = Position.$$x;
Position.x = Position.$$x + xd;
}
const yd = elapsed * (Forces.$$impulseY + Forces.$$forceY);;
if (yd) {
Position.lastY = Position.$$y;
Position.y = Position.$$y + yd;
}
}