Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

How to set up Skinned Mesh for DOTS physics?

Discussion in 'Physics for ECS' started by Studiomaurer, Mar 27, 2020.

  1. Studiomaurer

    Studiomaurer

    Joined:
    Sep 5, 2012
    Posts:
    56
    Hi, I'm just learning the new DOTS physics and HAVOK.

    So I'm trying to have a skinned mesh character interact with a couple of balls. The balls and the rest of the world are converted to entities and are bouncing around fine.

    The Skinned mesh carrys a bunch of Physics Shapes on the bone structure (as shown in the Unite Demo). However, if I "convert and destroy" the Skinned Mehs, unity (2019.3.f6) reliably crashes, if I "convert and inject game Object" the animation is fine, colliders are moving correctly, but they are not included into the physics world.

    What did I miss?
     
  2. Studiomaurer

    Studiomaurer

    Joined:
    Sep 5, 2012
    Posts:
    56
    So as nobody seems to be able to answer this I presume it is not possible to use Skinned mesh with the new Physics system...
     
  3. manpower13

    manpower13

    Joined:
    Dec 22, 2013
    Posts:
    140
    I don't think it is possible yet. Considering animations and skinned meshes, a lot still needs to be done and published.

    If someone does have a solution, I'm happy to hear it :D
     
  4. Studiomaurer

    Studiomaurer

    Joined:
    Sep 5, 2012
    Posts:
    56
    I guess so... I was just puzzled why they would demo on stage how the physics shape component can automatically generate colliders for skinned meshes if these colliders do not work in the physics world.
     
  5. Adam-Mechtley

    Adam-Mechtley

    Administrator

    Joined:
    Feb 5, 2007
    Posts:
    290
    The problem is that right now DOTS animation and skinned mesh rendering write to flat buffers rather than to entity transforms by default. Copying these results back to other entities (i.e. the rigid bodies) is an additional step with a lot of caveats. All the necessary parts will be landing throughout Q2, so I'd suggest keeping an eye on both the physics package and the animation package.
     
  6. snacktime

    snacktime

    Joined:
    Apr 15, 2013
    Posts:
    3,356
    With DOTS animation once you figure out how it's fairly straight forward to copy the data. There is an entity node in the graph that basically lets you copy data out of the animation system to an IComponentData. We use it for handling attachments but the approach should work fine for any bone.

    The caveats are mostly other things, like graph updates triggering world copies and stuff like that which isn't well optimized yet. Just figuring out how to setup a graph for your specific needs is a steep learning curve and don't expect high level api's, and the ones that do exist are what has seen the most churn also.
     
  7. Nyanpas

    Nyanpas

    Joined:
    Dec 29, 2016
    Posts:
    406
    Anything online to look at for this? Skinned meshes are currently the only reason I am holding out on moving to ECS.