Skip to content

Commit

Permalink
[2D Physics] Reduce the CPU footprint of static objects (#7299)
Browse files Browse the repository at this point in the history
  • Loading branch information
D8H authored Jan 10, 2025
1 parent 9c6a1be commit c0722dc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Extensions/Physics2Behavior/physics2runtimebehavior.ts
Original file line number Diff line number Diff line change
Expand Up @@ -964,7 +964,7 @@ namespace gdjs {
// It would be useless to try to recreate it as updateBodyFromObject already does it.
// If the body is null, we just don't do anything
// (but still run the physics simulation - this is independent).
if (this._body !== null) {
if (this._body !== null && !this.isStatic() && this._body.IsAwake()) {
this.owner.setX(
this._body.GetPosition().get_x() * this._sharedData.worldScale -
this.owner.getWidth() / 2 +
Expand Down

0 comments on commit c0722dc

Please sign in to comment.