How to set up Skinned Mesh for DOTS physics?

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?

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…

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 :smile:

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.

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.

4 Likes

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.

Anything online to look at for this? Skinned meshes are currently the only reason I am holding out on moving to ECS.

6 Likes