Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Excluding Vertices from Cloth Colliders in Unity 5

Discussion in 'Physics' started by MitchC, Apr 30, 2015.

  1. MitchC

    MitchC

    Joined:
    Sep 9, 2013
    Posts:
    22
    I posted this in the Unity Answers section, but it's been over a day now and I'm still awaiting moderator approval, so I figured I'd ask here too.

    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.
     
  2. MitchC

    MitchC

    Joined:
    Sep 9, 2013
    Posts:
    22
    I don't like to bump threads, but does anyone have any information about this?
     
  3. Narcotic904

    Narcotic904

    Joined:
    Jun 11, 2013
    Posts:
    14
    What are you using for character generation?
     
  4. MitchC

    MitchC

    Joined:
    Sep 9, 2013
    Posts:
    22
    Our own custom solution. It randomly grabs different body parts and materials and pieces them together, based off simple "recipes." The meshes I'm having trouble with are for the random crowd NPCs. We've merged some pieces together (legs and skirts, for example) to cut down on the number of objects, polys and complexity of the character recipes, which was fine until this issue came up.
     
  5. Narcotic904

    Narcotic904

    Joined:
    Jun 11, 2013
    Posts:
    14
    Unity 5 updated to a new version of PhsyX, this exact problem wasn't mentioned in the beta user guide, but it is most likely caused by that as well. If its your own custom solution why aren't you able to separate the objects? If you're worried about performance just use object pooling.
     
  6. MitchC

    MitchC

    Joined:
    Sep 9, 2013
    Posts:
    22
    We are able to separate the objects, but merging certain combinations was a choice made to manage the number of variations and have more control over style combinations. Basically, it was to reduce the headaches for our character artist.

    But that's besides the point. The issue I'm trying to solve is why, when a vert has its 'Max Distance' set to 0, can it still be moved? Surely setting it to zero should prevent it from moving at all. And also, what exactly is the 'Surface Penetration' setting supposed to do, since anything I set it to seems to have the same result. Other cloth solutions allow you to simply exclude verts from the cloth simulation entirely, it seems like a huge oversight if this isn't possible in Unity 5.