How to rollback to earlier physics state?

In the “Design philosophy” section of the unity dots physics docs, it mentions that one of the reasons it is designed the way it is, is to support things like “roll back”. However - after finishing reading the docs, I still have no idea what the recommended way to do this is. Do I need to rollback all ECS component state for all physics entities or just a subset of values or what?

The Netcode package does that sort of thing.
What exactly are you looking to achieve?
Keep a history of physics states over past frames and use this information, e.g., for authoritative decision making on the server in a multiplayer environment, or actually reset the simulation state?

As a hint into this feature set within the Netcode package, have a look at the Physics section in the package docs.

In the official PhysicsSamples project we provide a demo scene called “Pool” which performs predictive simulation which could also provide you with helpful entry points.

I want to reset the simulation state. I want to use this to do things like make save points within the game that I can reload later. I have read the pool sample but it didn’t seem like what I was looking for. I’ll check out what Netcode is doing, thanks for the suggestion

If you want to reset everything I guess you just need to save and restore the Entities data. That’s not a physics related question then. Maybe checking in the Entities subforum would help.

Edit: indeed. This might be what you are looking for:

1 Like