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

add ability to force update transforms #261

Merged
merged 2 commits into from
Oct 30, 2022

Conversation

cscorley
Copy link
Contributor

@cscorley cscorley commented Oct 8, 2022

This change allows for transform updates to always be applied.

In my physics simulation, I have a teleporting collider that is positioned based on user inputs. This simulation exists in a rollback networking-based game, where every public property of RapierContext is restored from a previous serialization upon rollbacks.

This change solves an issue when an Player A teleports their object, which causes Player B rollback. In B's client, the data is rolled back in both the Transform and the RapierContext, but the last_body_transform_set is not since it is not public outside of the crate. Since rollbacks re-simulate the inputs using the save state of the prior frame (e.g., before A teleported), the Transform for A is updated once again. When frames are re-simulated, the object A teleported is ignored on the resulting frame which causes a desync between the physics state of the two clients.

I have implemented this as a configuration option because I find it useful to conditionally toggle it during rollbacks only. This allows updates to only be forced during certain frame re-simulations rather than all the time.

@sebcrozet sebcrozet merged commit 748a826 into dimforge:master Oct 30, 2022
@sebcrozet
Copy link
Member

Thanks!

@sebcrozet sebcrozet mentioned this pull request Oct 30, 2022
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.

2 participants