Skip to content

fix: Destroy and create bodies after step is done#106

Merged
spydon merged 3 commits into
mainfrom
fix/destroy-bodies-after-step
Sep 7, 2025
Merged

fix: Destroy and create bodies after step is done#106
spydon merged 3 commits into
mainfrom
fix/destroy-bodies-after-step

Conversation

@spydon

@spydon spydon commented Sep 7, 2025

Copy link
Copy Markdown
Member

Description

This creates and destroys bodies after stepDt is done to avoid concurrency issues from destroying bodies based on for example taps or other gestures that can happen meanwhile stepDt is running.

Fixes: flame-engine/flame#3712

Checklist

  • The title of my PR starts with a Conventional Commit prefix (fix:, feat:, docs: etc).
  • I have read the Contributor Guide and followed the process outlined for submitting PRs.
  • I have updated/added tests for ALL new/updated/fixed functionality.
  • I have updated/added relevant documentation in docs and added dartdoc comments with ///.
  • I have updated/added relevant examples in examples.

Breaking Change

  • Yes, this is a breaking change.
  • No, this is not a breaking change.

Related Issues

@spydon spydon merged commit 92c7ccb into main Sep 7, 2025
3 checks passed
@spydon spydon deleted the fix/destroy-bodies-after-step branch September 7, 2025 17:16
@drrnbrns

Copy link
Copy Markdown
Contributor

I just stumbled upon an issue related to this change. In world.dart, the bodies are handled as expected (bodiesToCreate and bodiesToDestroy) but joints are added to jointsToCreate and jointsToDestroy but then never processed. That means nothing actually happens when adding or destroying a joint when the world is locked. Should I log a bug about this? The 4 lists should probably be private too, BTW.

@spydon

spydon commented Oct 26, 2025

Copy link
Copy Markdown
Member Author

I just stumbled upon an issue related to this change. In world.dart, the bohisdies are handled as expected (bodiesToCreate and bodiesToDestroy) but joints are added to jointsToCreate and jointsToDestroy but then never processed. That means nothing actually happens when adding or destroying a joint when the world is locked. Should I log a bug about this? The 4 lists should probably be private too, BTW.

Thanks for reporting this, can you try this PR if it solves your problem?
#110

@drrnbrns

Copy link
Copy Markdown
Contributor

Thanks, following up on that PR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

router and forge2d integration

4 participants