Uninomicon

Documenting the dark corners of the Unity Engine.

User Tools

Site Tools


physics_determinism

Physics Determinism

Limited Determinism

Unity uses the PhysX engine for physics1), and because of this, Unity physics provides Limited Determinism.

If a game executes the exact same set of physics API calls using the exact same frame timing, the engine will be perfectly deterministic, globally.

Recreating the Physics World2) will allow you to replay the exact same behavior a second time.

Local Determinism

There are no guarantees for determinism without recreating the physics world or restarting the game session. However, under the same forces and collider setup, most systems in PhysX are deterministic within a game session. This could be called “Local Determinism”: determinism that is local to a single area of the game or set of rigidbodies. For example, you can drop multiple balls and they will usually follow the exact same path of bounces.

Some systems that are known to break local determinism:

  • Using the Freeze Rotation / Freeze Position controls on a Rigidbody.
1)
Unless you are using the Entities preview Physics packages, which support a new Unity Physics Engine and Havok
2)
this can be done using the Unity scene load APIs
physics_determinism.txt · Last modified: 2021/05/20 22:12 by 73.95.178.156