Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

How is the new Experimental Unity Physics Deterministic?

Discussion in 'Physics Previews' started by sameerraina, Mar 24, 2020.

  1. sameerraina


    Feb 21, 2019
    Hi Everyone,
    in the samples for the unity.physics (v-0.3.1) package (in editor mode) go to : 6. Use Cases/Immediate Mode and open the pool scene. there, without changing the rotation and strength settings, click on take shot...wait for balls to stop...without changing rotation and strength, click on take this a third time. take a screenshot.
    repeat the above steps in a second run of the pool scene and take a screenshot. the arrangement of balls on the table will be different. how is this system deterministic?
    BTW, I loaded a build of the scene on my android device and got a different arrangement for the balls there as well.
    I think that as of now (unity physics 0.3.1), some more work needs to go into making the simulations deterministic both for same cpu and across platforms.
    any similar experiences or comments?
  2. Rory_Havok


    Jun 25, 2018
    The key part here is "wait for balls to stop". They may look stopped but they are not necessarily fully stopped. The exact floating point values of transform and velocity will depend on which frame you took the subsequent shots. If were to apply the exact same inputs on the exact same frame numbers, the results should be deterministic.
  3. steveeHavok


    Mar 19, 2019
    In the latest release the 'Immediate Mode' demo was changed to set the velocity of all the balls to when the sliders are changed. This removes the cpu specific determinism issues you are seeing. Cross platform determinism is dependent on the burst compiler.