15-01-2019, 08:08 AM
(This post was last modified: 15-01-2019, 08:10 AM by josemendez.)
(15-01-2019, 04:37 AM)ayoci Wrote: Hey, there is any way to get rope length in public float in Update()?
I tried some trick with pooled particles, totalparticles but i don't know what can i do. :/ I need the length only for display in "m".
Thanks for help.
Sure, if you want the rest length (prior to any stretching/compression) do:
Code:
rope.RestLength
or, if you want the actual length, taking stretching into account:
Code:
rope.CalculateLength();
For a measure of how much stretch/compression is taking place, just divide the two. This value is known as the "strain", a value of 1 means no stretch/compression, values larger than 1 mean the rope is stretched, and values less than 1 mean the rope is compressed.
Code:
float strain = rope.CalculateLength()/rope.RestLength;