Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
What can I adjust to stop a cloth from doing through a collision mesh?
#14
(28-01-2022, 01:14 PM)MoonBoop Wrote: I'm using the obi cloth stitcher to stitch together parts of a garment to form a complete garment.
Ive got the pieces being stitched together currently by giving the stitcher vertices that are known to be on stitch points for the garment.
I believe the stitching it working properly.

If I had to make a blind guess, I'd say the issue is that parts of the cloth that aren't adjacent to each other are being incorrectly stitched. This puts a lot of potential energy into the cloth and causes a "slingshot" effect, sending it flying in a random direction.

Try visually debugging this: stitch the cloth without using any avatar mesh, see if it stitches correctly. Add a proper material to it so that you can actually see the cloth instead of a pink blob.

On a side note: the stitching code you shared doesn't help much, since the important implementation bits are left out. For instance, how's VerticesOnCurve() implemented? What's stitches[0][i] and stitches[1][i]?

Code:
//Add stitches:
            var stencilData = stencil.Generate();
            foreach (ShapeData shapeData in stencilData)
            {
                foreach (CurveData curveData in shapeData)
                {
                    if (curveData.Stitched)
                    {
                        int[][] stitches = new int[2][];

                        for (int i = 0; i < meshData.Length; i++)
                        {
                            stitches[i] = meshData[i].VerticesOnCurve(curveData);
                        }

                        for (int i = 0; i < stitches[0].Length; i++)
                        {
                            Debug.Log(stitches[1].Length);
                            stitcher.AddStitch(stitches[0][i], stitches[1][i]);
                        }
                    }
                }
            }

Note that in the general case, vertex != particle. You can't use mesh vertex indices as particle indices, since vertices are welded together before creating particles. This is specially important if your mesh contains texture or normal seams.

Take a look at the "RuntimeCloth" sample scene: it creates a basic garment and stitches it together, all at runtime.
Reply


Messages In This Thread
RE: What can I adjust to stop a cloth from doing through a collision mesh? - by josemendez - 31-01-2022, 08:28 AM