How to make Spring Joint act like an actual spring?
Hey guys, I'm quite new to Unity and I've been fiddling around with Spring Joints lately but I'm really confused about how they work. So from the Manual:
The Spring Joint joins two Rigidbodies together but allows the distance between them to change as though they were connected by a spring.
And from the Scripting Manual:
The spring joint ties together 2 rigid bodies, spring forces will be automatically applied to keep the object at the given distance. The Spring attempts to maintain the distance it has when it starts out.
However, from my own testing it looks like all of this is simply not true. The spring joint simply tries to pull two anchors together until they occupy the same point in space, so there's no decompression happening at any point - similarly to how spring of length 0 would work in real life (if such a thing could exist in the first place). Which means that only this sentence from the Details section in the Manual (while still of questionable clarity) is correct:
The spring acts like a piece of elastic that tries to pull the two anchor points together to the exact same position.
To reproduce the behavior I'm talking about:
Place two Rigidbodies in a scene at some distance apart.
Disable gravity on both of them.
Connect them via Spring Joint.
Disable Auto Configure Connected Anchor.
Type in 0, 0, 0 for both anchors.
Once you press play, they'll snap together and after bouncing back and forth for a bit, they'll eventually stop at the same exact position, clipping trough one another. (I've tested it in Unity 2020.3.22f1 btw.)
Providing Min Distance equal to the distance between two anchors prevents snapping at play, but also simply sort of disables the spring forces completely if the anchors are closer together - it won't try to bounce back to Min Distance.
Am I missing something huge and obvious here? How can I make these joints to act like actual springs? Is this simply how they are supposed to work and the documentation is off? Or maybe I broke something unknowingly?
Your answer
Follow this Question
Related Questions
Spring based hook not working properly (Spring joint issue) 0 Answers
Spring Joint Grappling Hook help please 0 Answers
How to keep prefab spring joint anchors consistent when moving/placing? (2D) 0 Answers
I want To Limit Distance Spring can Stretch (SpringJoint2D) 0 Answers
Scale object between 2 moving objects 0 Answers