Skip to content

Commit

Permalink
Fix error when warming is off and it is first run
Browse files Browse the repository at this point in the history
  • Loading branch information
DrA1ex committed Sep 27, 2023
1 parent a2424e0 commit b1f92a1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions lib/misc/stack.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export class ObjectStack {
#savedPoints = [];

get used() {return this.#used;}
get savedCount() {return this.#savedPoints.length;}

constructor(spawnFn, blockSize = 1024, preallocate = false) {
this.#spawnFn = spawnFn;
Expand Down
2 changes: 1 addition & 1 deletion lib/physics/solver.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ export class ImpulseBasedSolver {
this.debug?.reset();
this.stepInfo.collisions.splice(0);

if (!this.warming) this.#collisionInfoPool.restore();
if (!this.warming && this.#collisionInfoPool.savedCount) this.#collisionInfoPool.restore();
this.#collisionInfos.splice(0);

this.stepInfo.collisionCount = 0;
Expand Down

0 comments on commit b1f92a1

Please sign in to comment.