fix: always set last position
This commit is contained in:
parent
7c976ad8c0
commit
9cfb06f66c
|
@ -23,14 +23,14 @@ export default class IntegratePhysics extends System {
|
||||||
if (!Forces || !Position) {
|
if (!Forces || !Position) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Position.lastX = Position.$$x;
|
||||||
|
Position.lastY = Position.$$y;
|
||||||
const xd = elapsed * (Forces.$$impulseX + Forces.$$forceX);
|
const xd = elapsed * (Forces.$$impulseX + Forces.$$forceX);
|
||||||
if (xd) {
|
if (xd) {
|
||||||
Position.lastX = Position.$$x;
|
|
||||||
Position.x = Position.$$x + xd;
|
Position.x = Position.$$x + xd;
|
||||||
}
|
}
|
||||||
const yd = elapsed * (Forces.$$impulseY + Forces.$$forceY);;
|
const yd = elapsed * (Forces.$$impulseY + Forces.$$forceY);;
|
||||||
if (yd) {
|
if (yd) {
|
||||||
Position.lastY = Position.$$y;
|
|
||||||
Position.y = Position.$$y + yd;
|
Position.y = Position.$$y + yd;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user