Skip to content

Commit

Permalink
Multiplayer fixes (#6668)
Browse files Browse the repository at this point in the history
* Prevent verticesBuffer to be synced for Physics2
* Ensure we create a force if no recycled are available
  • Loading branch information
ClementPasteau committed Jun 17, 2024
1 parent 528b8f4 commit da940ab
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 0 additions & 4 deletions Extensions/Physics2Behavior/physics2runtimebehavior.ts
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,6 @@ namespace gdjs {
ooa: this._objectOldAngle,
oow: this._objectOldWidth,
ooh: this._objectOldHeight,
vb: this._verticesBuffer,
},
};
}
Expand All @@ -509,9 +508,6 @@ namespace gdjs {
if (behaviorSpecificProps.ooh !== undefined) {
this._objectOldHeight = behaviorSpecificProps.ooh;
}
if (behaviorSpecificProps.vb !== undefined) {
this._verticesBuffer = behaviorSpecificProps.vb;
}
}

onDeActivate() {
Expand Down
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 da940ab

Please sign in to comment.