- Home /
Excluding Vertices from Cloth Colliders in Unity 5
I have a number of characters on which I'd like to use the new Unity 5 Cloth component. Some of our characters have the cloth meshes as completely separate objects, and are working fine. Some others are combined objects in which both the cloth and non-cloth meshes are together (this is out of necessity for our random character generation system). For example, the image below is one of the lower-halves of a character. It has a skirt, which I'd like to apply cloth to, and the legs/feet, which I don't want to be affected.
So, I select all of the vertices of the legs and feet, and set their 'Max Distance' to zero, so they're not simulated.
You can see the colliders on the thighs, coming down slightly longer than the shirt. This seems fine, until I press play and get this:
The colliders are pushing out the verts of the thighs, even though I set their 'Max Distance' to zero. I don't want them to be affected by the simulation at all. I don't really understand what the 'Surface Penetration' option is supposed to do. It doesn't seem to make any difference, whether I set it to 0 or 10000.
I've also tried setting the colliders to be smaller than the thigh mesh, which stops them from puffing out, but then of course the thighs frequently clip straight through the skirt and looks horrible.
Before moving to Unity 5, we were using Shroud Cloth Sim Engine from the Asset Store. This exact asset was fine with Shroud, because I could just tell it to treat those vertices as skinned. Splitting the legs and skirt into separate objects isn't an option in this situation. If there's no way to solve this, we'll just have to abandon cloth for these characters, which we obviously don't want to do.
Sorry to necro an old thread. Did this end up getting resolved? As we are having the same issue in 5.3.2f1 and can't find a way to fix it anywhere. @yant
We ended up starting our own thread by the time this post got approved. http://answers.unity3d.com/questions/1146227/unity-5-cloth-colliders-inflating-mesh.html
Apologies again
Answer by nebera · Oct 16, 2017 at 07:08 PM
Has this issue ever been resolved? I'm running into a similar problem where setting the max distance to 0 does not prevent cloth vertices from being affected by colliders. You can separate meshes, but that is not always ideal.
Answer by yant · Jun 02, 2015 at 10:55 AM
Hey Mitch!
Can I get you to file a fogbugz case please? Settings maxDistance to 0 should have an effect of sticking the cloth particles to the mesh vertices they were created from. What I see here does not sound to be expected unless there are other circumstances not visible on the screenshots.
As for the surface penetration constraint - it's simply the maximum distance a cloth particle can travel inside the mesh (measured along the negative normal). PhysX only allows us to use sphere shaped separations constraints, so actually per each mesh vertex we configure a sphere of radius equal to twice the value of max distance constraint centered at twice the max distance constraint plus surface penetration value along the negative direction of the normal. Any cloth particle will avoid being inside such spheres. Think of that as an approximation of a mesh surface with spheres.
Hope this helps.
Anthony
Answer by robson_depaula · Jan 25, 2017 at 01:16 PM
Please excuse the follow-up on an old thread and sorry for not posting as a comment, it gives me an error when I click on "Add comment".
What I would like to suggest is that the image cloth-constraints001.jpg attachment be published on the Cloth manual https://docs.unity3d.com/Manual/class-Cloth.html.
It helped me understand the constraints.
Your answer
Follow this Question
Related Questions
Physics.OverlapSphere not detecting Instantiated Objects 1 Answer
Physics.Simulate and Physics.UpdateCloth spike even though no rigidbodies present 0 Answers
ball's collider sometimes catches an edge and bounces. when ball rolls over two aligned platforms 1 Answer
Unity 5 - Cloth falling through floor 0 Answers