Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to read out stretch
#4
(05-11-2017, 04:53 PM)mbbmbbmm Wrote: 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!  Huh
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!

A restLenght of 0 indicates a zero-length edge in your mesh. This should generally be best avoided as it is a form of non-manifoldness, but if it works for you then I wouldn't worry too much.

GetParticlePosition() is part of ObiActor, from which ObiCloth is derived. Depending on where you're writing this code you should be able to call GetParticlePosition() directly.
Reply


Messages In This Thread
How to read out stretch - by mbbmbbmm - 05-11-2017, 02:44 PM
RE: How to read out stretch - by josemendez - 05-11-2017, 03:34 PM
RE: How to read out stretch - by mbbmbbmm - 05-11-2017, 04:53 PM
RE: How to read out stretch - by josemendez - 05-11-2017, 05:41 PM