Thanks for your help, that sounds nice, the rough estimation would be totally sufficient for me. The cloth mesh is not tooo huge as well (ConstrainCount is 620). Maybe I could even skip every other Particle to optimize or so.
BUT.. the moment I divide distance / distanceBatch.restLengths[i] I get NaN!
So the final result is also NaN. Is this some weird floating point precision problem?
Also I am not sure about the GetParticlePosition ? Is it correct using it with cloth and the dot operator? It gave me red squigglies when I had it directly like in your example...
Thank you!
J
Aha, it appears there are a few zeros in the distanceBath.restLengths. Checking and adding 0f instead seems to do the trick. Thanks again!
BUT.. the moment I divide distance / distanceBatch.restLengths[i] I get NaN!
So the final result is also NaN. Is this some weird floating point precision problem?
Also I am not sure about the GetParticlePosition ? Is it correct using it with cloth and the dot operator? It gave me red squigglies when I had it directly like in your example...
Code:
float distance = Vector3.Distance(cloth.GetParticlePosition(distanceBatch.springIndices[i * 2]),
cloth.GetParticlePosition(distanceBatch.springIndices[i * 2 + 1]));
Thank you!
J
Aha, it appears there are a few zeros in the distanceBath.restLengths. Checking and adding 0f instead seems to do the trick. Thanks again!