Hello!
I am trying to simulate rope physics with spring joints (As hinge joints gave me serious trouble), and in order to appropriately simulate that thick rope has a maximum bend, I have attatched spring joints at every other joint.
[Imgur: The magic of the Internet][1] ← Like so
But Unity doesn’t seem to like this! The “rope” starts to jiggle and bounce everywhere. I suspect I am doing something awfully wrong, someplace, but I can’t quite figure out where.
arrOfGameObjects is an array of instantiated prefabs.
for(int i = 0; i < maxCount; i++)
{
//The last should not have a spring attached
if(i < maxCount - 1)
{
SpringJoint spring = arrOfGameObjects*.AddComponent<SpringJoint>();*
-
spring.spring = springValue;*
-
spring.damper = dampening;*
-
spring.connectedBody = arrOfGameObjects[i + 1].rigidbody;*
SpringDrawer drawer = arrOfGameObjects*.AddComponent();*
drawer.target = arrOfGameObjects[i + 1].transform;
drawer.width = 0.1f;
drawer.Init();
* }*
if (i < maxCount - 2)
{
SpringJoint spring = arrOfGameObjects*.AddComponent();*
spring.spring = springValue;
spring.damper = dampening;
spring.connectedBody = arrOfGameObjects[i + 2].rigidbody;
}
* }*
_*[1]: http://imgur.com/QkpBFCc*_