Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix case for bodies which begin as dynamic. #13

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

gfodor
Copy link

@gfodor gfodor commented Jan 2, 2021

This fixes an issue where the physics system does not properly handle the case where a new body is added that is initially set to DYNAMIC. Dynamic bodies are currently always synced out of the physics engine on every tick, however this means that if a body starts out as dynamic, its initial transform is never written to the physics engine (so it ends up just getting an identity transform in the physics engine.)

To fix this, bodies now explicitly track the first three sync passes in a counter, and if a body is dynamic and its first and second syncs are seen while its dynamic, then the worker waits for the initial transform to be written by the host process, syncs it to physics, and then proceeds as usual.

Also addresses a potential bug where the matrix offset in the buffer was not being used when resetting dynamic objects.

…to explicitly manage the first 3 initial physics syncs to coordinate the host process setting the initial transform properly before physics starts driving it.
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.

1 participant