(17-11-2022, 11:24 AM)lufydad Wrote: Hi,
I made a scene with a rope that is pulled on both sides. At the start its size is 4.28 m and later when attachments pulled it we see in unity a size of approximatly 15 m but rest length still show 4.28 m (see https://imgur.com/a/9YfSQc6).
Is there something that I don't understand with rest length ? I based my thought on Changing rope length at runtime: ObiRopeCursor : "It is very useful to know the current length of the rope when working with cursors. Use the rope's RestLength property for this.".
Thanks in advance,
Hi!
The rest length is -as the name implies- the length of the rope
at rest: this is, when it isn't stretched nor compressed. You can stretch a 4.28 meters long rope until it reaches 15 meters, but that doesn't change the fact that the amount of rope in there is still 4.28 meters, and will return to 4.28 once the stress forces cease to act upon it: no matter is created/destroyed in the process
.
The actual length can be completely different from the rest length depending on how much the rope is stretched or compressed. The rest length is determined when you create the rope blueprint, while the "actual" length must be recalculated at runtime since it can change. To calculate the current length of the rope, use rope.CalculateLength().
There's something useful you can do with both rest length and the actual length, and that's to calculate
strain: a measure of how much stretch/compression the rope is undergoing. This is just the ratio between both values:
Code:
float strain = rope.CalculateLength() / rope.restLength;
strain will be > 1 if the rope is stretched, < 1 if it's compressed, and 1 if there's no stress forces acting upon it.
Quote:I based my thought on Changing rope length at runtime: ObiRopeCursor : "It is very useful to know the current length of the rope when working with cursors. Use the rope's RestLength property for this.".
Knowing the rest length is useful when dealing with cursors because they set the rest length of the rope: they "add" or "remove" matter to/from the rope, so to speak. The rope may very well be stretched under a lot tension while this happens, or may not be at all.
let me know if you need any help,
kind regards