According to Spring Joint's documentation, a spring's resting length (the length at which the spring won't try to pull or push together the two bodies it connects) is the distance that was calculated between the two bodies as the joint was created.
However, I'd like to be able to change this resting distance at runtime, and the documentation doesn't mention anything about how the length can be changed.
Is there anyway to accomplish this with Spring Joint? If not, how to create a spring with a set resting length (which can be changed in a script) with Configurable Joint?
The resting length of a spring depends on its spring rate and how much force is applied to it. More force and/or less rate reduces the resting length. You can calculate the compression depth as:
compression = force/rate
Thus, specifying a resting length requires you to know the force the spring will be supporting at rest. Using the above equation you can then calculate the spring rate required for the spring to rest at that length.
I hope this helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With