Obi Official Forum
Help Rope length in float - Printable Version

+- Obi Official Forum (https://obi.virtualmethodstudio.com/forum)
+-- Forum: Obi Users Category (https://obi.virtualmethodstudio.com/forum/forum-1.html)
+--- Forum: Obi Rope (https://obi.virtualmethodstudio.com/forum/forum-4.html)
+--- Thread: Help Rope length in float (/thread-818.html)



Rope length in float - ayoci - 15-01-2019

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


RE: Rope length in float - josemendez - 15-01-2019

(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;



RE: Rope length in float - ayoci - 15-01-2019

rope.CalculateLength(); that's what i needed, you save my day!  Gran sonrisa 
Thanks for the fast reply!!