Search Unity

Question Creating a bucket with DOTS physics

Discussion in 'Physics for ECS' started by DevViktoria, Nov 23, 2021.

  1. DevViktoria

    DevViktoria

    Joined:
    Apr 6, 2021
    Posts:
    94
    Hi,
    I would like to create a bucket like thing with DOTS physics where balls can fall in. But the ball falls through it.
    With Unity classic physics it can be done with a mesh collider, but unfortunately the corresponding physics shape with the mesh shape type does not work in DOTS physics.
    See the attached screenshots.
     

    Attached Files:

  2. VincentSai1984

    VincentSai1984

    Joined:
    Sep 7, 2020
    Posts:
    9
    Use convex hull don't use mesh
     
  3. DevViktoria

    DevViktoria

    Joined:
    Apr 6, 2021
    Posts:
    94
    Thanks for the tip. Unfortunately the convey hull does not work because it creates a drum like collider and the ball cannot fall into the hole.
    upload_2021-11-25_12-24-44.png
    I turned on drawing the colliders, so you can see what is the generated collider in that case.
    In another project where I need the functionality I set up plane colliders to mimic a square hole like so:
    upload_2021-11-25_12-27-42.png
    (Actually there is a another horizontal plane for the bottom on a different empty, which is not seen on the screenshot above.)
    That seem working, but this solution does not follow the round shape exactly :(
     
  4. VincentSai1984

    VincentSai1984

    Joined:
    Sep 7, 2020
    Posts:
    9
    We use some tool to convert the single mesh to multiple mesh, then use them as sources of convex hull, a entity can attach multiple PhysicsShape
     
    DevViktoria likes this.
  5. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    https://github.com/Unity-Technologies/VHACD should be workable as a generator for compound convex hulls that will support any kind of source geometry. It just spits out convex meshes you can repurpose for anything.

    There's a documentation md file for further info in the source repo.
     
    DevViktoria likes this.