Skip to content

Commit

Permalink
Ensure we create a force if no recycled are available
Browse files Browse the repository at this point in the history
  • Loading branch information
ClementPasteau committed Jun 17, 2024
1 parent 0480900 commit f7bce50
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion GDJS/Runtime/runtimeobject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,11 @@ namespace gdjs {
this.clearForces();
for (let i = 0, len = networkSyncData.if.length; i < len; ++i) {
const forceData = networkSyncData.if[i];
const recycledOrNewForce = RuntimeObject.forcesGarbage.pop() as gdjs.Force;
const recycledOrNewForce = this._getRecycledForce(
forceData.x,
forceData.y,
forceData.m
);
recycledOrNewForce.updateFromNetworkSyncData(forceData);
this._instantForces.push(recycledOrNewForce);
}
Expand Down

0 comments on commit f7bce50

Please sign in to comment.