serde-serialize feature of Rapier is enabled, most data structures of Rapier become serializable using serde.
Serialization can be useful to save the complete state of the simulation, e.g., to send it over the network, or to restore
this state later. In order to fully serialize the simulation state, it is necessary to serialize every structure
described in the simulation structures page, except for the
PhysicsPipeline and the
CollisionPipeline which don't hold any useful state. The following shows an example of serialization of the
complete physics state. For convenience, the example defines a
PhysicsState serializable struct that wraps every
relevant serializable state. It uses bincode as the serialization format:
enhanced-determinism feature of Rapier is enabled, and if your platform fulfills the required determinism
requirements, then you have the guarantee that running the exact same simulation on two different machine
will result in the exact same byte vectors if the physics state is serialized on both machines after the same
number of timesteps.