bevy_xpbd icon indicating copy to clipboard operation
bevy_xpbd copied to clipboard

Document components and resources needed for rollback

Open Jondolf opened this issue 1 year ago • 6 comments

For things like networking, it can be important to enable rollback for certain physics components and resources to avoid mispredictions. However, it can be unclear which components should be rolled back without good knowledge of engine internals.

Avian should have documentation listing stateful components and resources that can affect simulation behavior and are important for rollback.

List of components and resources

Below, I've listed the ones that come to mind.

Components:

  • Position
  • Rotation
  • LinearVelocity
  • AngularVelocity
  • ExternalForce (if used, and only if persistent)
  • ExternalTorque (if used, and only if persistent)
  • ExternalImpulse (if used, and only if persistent)
  • ExternalAngularImpulse (if used, and only if persistent)
  • Sleeping (if sleeping is enabled; enabled by default)
  • TimeSleeping (if sleeping is enabled; enabled by default)
  • CollidingEntities (if used)

Resources:

  • Collisions (only if solver warm starting is enabled; enabled by default)

You may also need to roll back Transform and GlobalTransform, as changes to them can affect Position and Rotation either directly or through hierarchies.

If you notice components or resources missing that are important for rollback, let me know :)

Jondolf avatar Aug 03 '24 20:08 Jondolf