Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Rope length in float
#1
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
Reply
#2
(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;
Reply
#3
rope.CalculateLength(); that's what i needed, you save my day!  Gran sonrisa 
Thanks for the fast reply!!
Reply