Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

How is the new Experimental Unity Physics Deterministic?

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

  1. sameerraina

    sameerraina

    Joined:
    Feb 21, 2019
    Posts:
    2
    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 shot...do 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

    Rory_Havok

    Joined:
    Jun 25, 2018
    Posts:
    70
    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

    steveeHavok

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