22-02-2021, 02:59 PM
(19-02-2021, 04:11 PM)josemendez Wrote: I don’t think you can reliably use list intersection() or contains() operations when the contents are floating point data. These use the type’s default comparer. This won’t work unless you provide a custom comparer that uses an epsilon to tell if two Vector3 are close enough to each other. Unless the particle positions are *exactly* the same, a direct comparison between floating point values is very likely to fail.Hello and thanks for the reccomendation!
See: https://docs.unity3d.com/ScriptReference...ately.html
Using what you said and adding some checkings i managed to achieve what i wanted
Code:
for (int i = 0; i < 289; i++)
{
for (int j = 0; j < 289; j++)
{
if (Mathf.Approximately(clothParticles1[i].y, clothParticles2[j].y))
{
if (Mathf.Approximately(clothParticles1[i].x,clothParticles2[j].x))
{
stitcher.AddStitch(i, j);
}
}
}
}