Search Unity

Cloth Vertices differ from Mesh Vertices

Discussion in 'Physics' started by tiggaxxx, Feb 23, 2022.

  1. tiggaxxx

    tiggaxxx

    Joined:
    Jan 13, 2020
    Posts:
    30
    I have been working with the cloth component and found myself in need to create a script to edit constraints of specific submeshes automatically, as sometimes it's just impossible to paint the right vertices through the UI and it's very time consuming..

    The thing is, the ammount of vertices of the cloth component isn't the same as from the mesh renderer.

    I've already tried to eliminate duplicated vertices from the mesh, it bring the ammount closer, but it's still not the same... so i thought of forcing the cloth component vertices to be the same as the mesh, but the vertices from the cloth component seem to be read only..

    Any sugestions? Anyone had or has the same issues?
     
  2. r31o

    r31o

    Joined:
    Jul 29, 2021
    Posts:
    460
    The cloth has more or less vertices?
     
  3. tiggaxxx

    tiggaxxx

    Joined:
    Jan 13, 2020
    Posts:
    30
    Less
     
  4. Qleenie

    Qleenie

    Joined:
    Jan 27, 2019
    Posts:
    866
    That's a normal thing. A cloth algorithm will skip vertices with same position, as they would break the cloth structure, leading to separated pieces of cloth There was a discussion once in this forum, and someone build some sort of mapping of vertices and put it on github if I remember correctly.
     
  5. tiggaxxx

    tiggaxxx

    Joined:
    Jan 13, 2020
    Posts:
    30
    I have searched, but didn't found anything any code.. i found someone talking about something similar, so i did a script that creates a dictionary and removes duplicated vertices, it gets closer to the number, but it's still higher.
     
  6. Qleenie

    Qleenie

    Joined:
    Jan 27, 2019
    Posts:
    866