Search Unity

Joint stretching problem

Discussion in 'Editor & General Support' started by Bent, Mar 17, 2008.

  1. Bent

    Bent

    Joined:
    Feb 12, 2008
    Posts:
    34
    Hello,

    I have a problem related to joint. Let say that I am trying to make a tail by using a series of joint. This tail will be moved by physics engine in Unity. The tail arrangement is like this:

    (Body)---(j1)---(j2)---(j3)---(j4)---(j5)---(j6)

    The following is my configuration:
    j1 has Rigidbody and IsKinematic is set to true. It doesn't have any joint.

    From j2 to j6, all the joints are set to the same configuration as the following:
    - each joint has Rigidbody
    - the connected body is the the joint before it.
    - X, Y, and Z motion is locked
    - Angular X and Y motion is locked
    - Angular Z motion is limited
    - IsKinematic is left as fault (default)

    After I press play, what happens is that the tail is working fine when I rotate the body around. But when I apply some translation to the body such as walk, or run, there is one joint stretching which is joint j2. The faster the body runs, the more j2 is stretching. Later on I tried to use all the other joint types available in Unity such as Hinge, Fixed, Spring, and Character joint to apply on j2. All the results pretty much go in the same way: j2 stretches.

    Please kindly tell me what I am doing wrong. Is there a way to fix it?
     
  2. ratamorph

    ratamorph

    Joined:
    Sep 2, 2007
    Posts:
    458
    I got a very similar problem, I´m trying to create a hose made out of bones with skinning, I attach a spring joint to each bone and one fixed joint to the one on top to achor it, it seems like gravity pulls all my joints down making each spring stretch, the one on top stretches the most since it´s being pulled by the other joints and so on.

    I tried setting the mass for each of my joints to the very lowest Unity allows me (0.01), and cranking up the spring strength but nothing seems to create the behavior I expect, the hose stretches to much for my liking, it's not bad when I have say 5 joints, but when I have 20 joints with each joint stretching it can go up around 400% it's original lenght...

    Is there a better way to do this?
     
  3. ratamorph

    ratamorph

    Joined:
    Sep 2, 2007
    Posts:
    458
    This is driving me insane so I'll post some images.

    The first one is how my springs are set up.
    Next is how they look after leaving them running for a bit(at rest). The numbers show the length % of my spring chain, notice the big stretching on the mesh version.

    Last pic is how the scene looks like when the game is not running.

    All springs are set up with the same values.
     

    Attached Files:

  4. ratamorph

    ratamorph

    Joined:
    Sep 2, 2007
    Posts:
    458
    And now the package.
    If anyone can tell me how to make it so my hose doesn't stretch this much, just like a real hose I'd be forever grateful.
     

    Attached Files:

  5. Adam-Mechtley

    Adam-Mechtley

    Administrator

    Joined:
    Feb 5, 2007
    Posts:
    290
    Hi ratamorph. Unfortunately I don't have an answer for you, but I will say I have had this same problem with ragdolls. My chain was Rigid Body 1 -> Kinematic Rigid Body -> Rigid Body 2. In this case, Rigid Body 2 was staying in its same position when I hit play. However, while the comp was playing, grabbing Rigid Body 1 in the editor view and translating it any amount in any direction would cause Rigid Body 2 to snap into the correct position. Hopefully someone can explain the issue.
     
  6. ratamorph

    ratamorph

    Joined:
    Sep 2, 2007
    Posts:
    458
    I ended up making my hose out of character joints and it behaves much better than with the springs, still, I´d like to know a way to make a chain of springs that doesn´t stretch this much, or maybe figuring out a way to tweak the springs to achieve the desired behavior.
     
  7. ireneus

    ireneus

    Joined:
    Nov 4, 2017
    Posts:
    1
    Sorry for replying to this very old post.
    But now that you work for Unity ;). Could you figure out what causes the issue of the bone-stretching which is attached to a bone (via any jointtype) that has a RigidBody which is set to isKinematic?
    Because it is definitely the isKinematic state of that rigidBody that causes this.
    This really feels like a bug.
    Would be great if anybody of the unityDevs could explain that mistery ;).

    Thanks,
    Ireneus
     
  8. Deleted User

    Deleted User

    Guest

    Still nothing? I've tried just about everything and every joint I make still stretches way too much. Over a decade and this problem still hasn't been fixed?
     
    CloudyVR likes this.
  9. CloudyVR

    CloudyVR

    Joined:
    Mar 26, 2017
    Posts:
    715
    I wish joints were not so impossible to use. I have been doing a lot of research trying to figure out how to allow for sligtht stretching of a ragdoll without it going crazy. So far no combination of joints or changing any parameter has helped reduce jitter. I have tried every suggestion on Unity forum but most answers only make the jittering worse.