21-04-2021, 12:22 PM
(This post was last modified: 21-04-2021, 12:23 PM by josemendez.)
(21-04-2021, 11:49 AM)gigass21 Wrote: I think i have an idea to validate to stop the movement through the script to check the length of the Rope.
I found this function, so it can't be more than a specified length. If the dog travels more than the length, i'll stop the chase.
Code:obiRope.CalculateLength()
Does that the correct function to check the length?
I haven't tried this, but thank you for explaining.
Yes, this function calculates the current rope length. Note this is different from the rest length, which is the length of the rope with no stretching/compression.
Both can be used to calculate strain, which is the ratio of current length to rest length. It will be <1 if the rope is compressed, ==1 if the rope remains at rest length, > 1 if the rope is stretched.
Code:
float strain = rope.CalculateLength() / rope.restLength;