Obi Official Forum

Full Version: Rope length in float
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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. Sonrisa
(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. Sonrisa

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;
rope.CalculateLength(); that's what i needed, you save my day!  Gran sonrisa 
Thanks for the fast reply!!