Search Unity

Bug Stability of stacked cubes in DOTS physics

Discussion in 'Physics for ECS' started by darbotron, Apr 11, 2021.

  1. darbotron

    darbotron

    Joined:
    Aug 9, 2010
    Posts:
    352
    Hi

    I know it's in preview, so I was having a good look at DOTs physics before maybe using it for an upcoming game.

    As a basic test I made a stack of cubes and I was unpleasantly surprised to find that Unity Physics doesn't seem to be able to stably simulate a stack of 4 cubes without it falling over.

    It's entirely possible that I've made some sort of mistake in the setup so I thought I should check in here.

    I've got one stack of regular monobehaviour physics cubes:
    upload_2021-4-11_10-50-38.png


    one stack of non-DOTs physics components converted using the Convert To Entity
    upload_2021-4-11_10-52-44.png

    and one stack of cubes converted by Convert to Entity using the Physics Body & Physics Shape

    upload_2021-4-11_11-7-8.png

    when I press play in the editor the legacy physics cubes land in a stable stack, both stacks of DOTs physics cubes initially land stable-ish, then they slide about and fall over:

    upload_2021-4-11_11-12-27.png

    I've attached the unity project in case it helps get to the bottom of it.

    I was also wondering if this was a known issue, as I recall reading in the docs that the new Unity Physics system is stateless, and I know that lots of objects in static contact is actually a tricky problem which physics engines I've used before use cached contacts to help deal with.
     
    Last edited: Apr 11, 2021
  2. darbotron

    darbotron

    Joined:
    Aug 9, 2010
    Posts:
    352
    oops! forgot the project - here it is :)
     

    Attached Files:

  3. In general, Unity Physics is not the best choice if you want stable stacking. It is a stateless Physics engine. If you want stable stacking and you want DOTS, you need either Havok or roll your own calculations.

     
  4. steveeHavok

    steveeHavok

    Joined:
    Mar 19, 2019
    Posts:
    481
  5. darbotron

    darbotron

    Joined:
    Aug 9, 2010
    Posts:
    352
    I can appreciate that the stateless approach essentially precludes stable stacking but it's pretty much a base level requirement from a physics engine for a game right?

    TBF this is really a pretty poor situation - as a pro user this means I will have to pay an additional cost for a 3rd party physics solution in order to be able to use DOTS physics to make a game with "standard physics behaviour" :-/
     
    Last edited: Apr 18, 2021
  6. darbotron

    darbotron

    Joined:
    Aug 9, 2010
    Posts:
    352