Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Can I attach particeattachment in script?
#11
Quote:This might be obvious, but you should *not* rely on the Y values of all waist particles being *exactly* the same. Even if whoever modeled the skirt made the wait perfectly horizontal, vertices won't have the same height due to floating point error. You should pick one representative particle (for instance the topmost one) and then compare all others with it, using a threshold.
Hello. My original goal was to find particles  located on wasitline of the skinnedclothbluprint  based on the assumption that all vertices in waistline of the cloth ( which are located in the highest position in the cloths like skirts and pants) have same Y position, so I just need to get the highest positions's particles for setting wasitline particles. But after I realized all the vertices in the waistline part in the cloth asset mesh, I changed my goal to find the number of the amount in the waistline of the cloth mesh, so I can just need to find the toppest skinned cloth blueprint's particle around waistline using the number. To do this, I have to find amount of the highest vertices in the waistline in every cloth assets mesh. The problem is, each cloth asset mesh has different amount of the vertices in their waistline, so I need to find a way to get amount of the vertices in the wasitline in script during runtime. Currently, I'm trying to solve this with finding connected vertices which has only 3 connected vertices cause except the this highest vertices and lowest vertices in the cloth mesh, all verices have 4 connected vertices each(I know for obi, mesh is converted to the trianlges  but what Im trying to do is find connected vertices in the orignal cloth mesh which has quads). If I,from the toppest vertice , start to find connected vertices which have 3 connected vertices, then I can find all vertices in the waistline, then I can get a number of this waist line vertices' amount, which can be used to find right particles in the waistline in the cloth blueprint. I'm trying to get this using obi script, fbx file reading in during runtime using c#, and trlib2(not using all of them to do this during the runtime, just trying to fine fastest way). And I'm stuck now. Is there any way to solve this? after reading your reply, I'm trying to use skin radius value with 0, but it takes long time to do all the cloth assets that we already made, to each different body types that we have to check(in our situation, there's some cases that big body wears small cloth or small body wears big clothes. Does this - skin radius with 0 value - cause that any small clothes go through skin of the big body?

**and we have baggy clothes too, so clothes shouldnt be attached just on skin of the body like bodycon style.


Quote:Quite possibly, editor UI breaking in this way usually means there's been an error while rendering the editor. Did you add any custom code to the blueprint and/or blueprint editor?

When/how are you calling this code?


All of the cloth meshes' vertices are more than 1000 and less than 4~5000. And I didnt put any custom code into obi package code, but I'll check it again just in case. And this code is called only once in the Awake method. And the cloth gameobject of this skinned cloth blueprint is disabled before play, so I can just make it enabled after this code's script works during the runtime.
Reply
#12
(20-09-2024, 09:21 AM)gahyun11 Wrote: Hello. My original goal was to find particles  located on wasitline of the skinnedclothbluprint  based on the assumption that all vertices in waistline of the cloth ( which are located in the highest position in the cloths like skirts and pants) have same Y position, so I just need to get the highest positions's particles for setting wasitline particles. But after I realized all the vertices in the waistline part in the cloth asset mesh, I changed my goal to find the number of the amount in the waistline of the cloth mesh, so I can just need to find the toppest skinned cloth blueprint's particle around waistline using the number. To do this, I have to find amount of the highest vertices in the waistline in every cloth assets mesh. The problem is, each cloth asset mesh has different amount of the vertices in their waistline, so I need to find a way to get amount of the vertices in the wasitline in script during runtime. Currently, I'm trying to solve this with finding connected vertices which has only 3 connected vertices cause except the this highest vertices and lowest vertices in the cloth mesh, all verices have 4 connected vertices each(I know for obi, mesh is converted to the trianlges  but what Im trying to do is find connected vertices in the orignal cloth mesh which has quads). If I,from the toppest vertice , start to find connected vertices which have 3 connected vertices, then I can find all vertices in the waistline, then I can get a number of this waist line vertices' amount, which can be used to find right particles in the waistline in the cloth blueprint. I'm trying to get this using obi script, fbx file reading in during runtime using c#, and trlib2(not using all of them to do this during the runtime, just trying to fine fastest way). And I'm stuck now. Is there any way to solve this?

There's many other options.

One is to use an edge loop detection algorithm: start at the topmost edge and iterate trough edges, picking always the edge opposite to the current one until you return to where you started.

Or, a border detection algorithm: build a half-edge data structure out of the mesh, and pick half-edges that have no pair. Out of all of them, the ones above the centroid of the mesh will be the waist.

Or, a hole detection algorithm, and again the topmost hole will be the waist.

(20-09-2024, 09:21 AM)gahyun11 Wrote: after reading your reply, I'm trying to use skin radius value with 0, but it takes long time to do all the cloth assets that we already made, to each different body types that we have to check(in our situation, there's some cases that big body wears small cloth or small body wears big clothes.


(20-09-2024, 09:21 AM)gahyun11 Wrote: Does this - skin radius with 0 value - cause that any small clothes go through skin of the big body?

**and we have baggy clothes too, so clothes shouldnt be attached just on skin of the body like bodycon style.

Skin radius = 0 just drives the particle using full animation, no simulation. Whether it goes trough the body or not entirely depends on how well skinned the cloth mesh is. If skin weights are not properly authored, it may of course go trough the body.

Note that regardless of the method used (attachments or skin radius), you need to detect the waist particles: be it to create a particle group with them, or to set their skin radius.
(20-09-2024, 09:21 AM)gahyun11 Wrote: All of the cloth meshes' vertices are more than 1000 and less than 4~5000. And I didnt put any custom code into obi package code, but I'll check it again just in case. And this code is called only once in the Awake method. And the cloth gameobject of this skinned cloth blueprint is disabled before play, so I can just make it enabled after this code's script works during the runtime.

Are there any errors popping up in the console when this happens?
Reply