Search Unity

[Solved] Troubleshooting Joint Behavior in Ragdoll

Discussion in 'Physics' started by hausrath, Jan 17, 2018.

  1. hausrath

    hausrath

    Joined:
    Sep 30, 2016
    Posts:
    5
    Hi All,

    I'm researching what could be causing some vibrating/separating joints, as seen here:



    I'm using "Move Towards" to adjust the position of the Player object, expecting the shoulder/arm/elbow/forearm object joints to ragdoll with it. Here's what I've got for solutions:

    From this forum post
    • Using “move towards” to move the player object towards the mouse position, instead of adding force or impulse to it in that direction
      • This would happen because the rigid bodies are trying to hit the colliders, but move towards is telling them to ignore that and keep moving.
    • Could it be caused by the frequency or damping settings?

    From this forum post, the problem could be related to how my anchors are set.

    From this forum post, I could try to add a distance joint between the first segment (player) and the last arm segment. This kind of seems like a solution to a different problem, though, so I’m not sure it would apply.

    Finally, this forum has some interesting ideas, namely to work with joint Projection and Solver Iteration Count within the joints.

    Actually, one more - and shout out to the "Similar Topics" below the "Create Post" here: This page in the manual may just have answered my question, but I’ll post anyway in case others are having a similar issue. It recommends many things:
    • Disabling Preprocessing within the joints. It specifically says do this to “prevent joints from separating or moving erratically.”
    • Enabling Projection and Solver Iterations.
    • Avoid scaling (which I definitely did not do in the project)
    • Transform with Rigidbody2D.MovePosition
    • Advises against overlapping rigidbodies
    I was going to ask for your advice, but I'll go ahead and try a few things first, then I'll come back and update if additional questions come up, or if I find a solution.

    Thanks!
     
  2. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    25,627
    @MelvMay is the resident expert on all things 2D physics (and more) might know if he is not too busy!
     
  3. hausrath

    hausrath

    Joined:
    Sep 30, 2016
    Posts:
    5
    Thanks very much, hippocoder. I appreciate the reference!

    I went through the manual and the first thing I adjusted made a huge difference. I moved the rigidbodies away from each other slightly, so that they were no longer overlapping on spawn. Boom. Problem solved. Looks like it was just a newbie mistake this time.

    I'm getting some strange behavior related to mass (I think) on a couple objects, but my guess is that it's related to scaling, as I drastically scaled some of the stock assets to bust out a quick prototype.

    Thanks again for your quick response. Looking forward to moving forward with the project.
     
    MelvMay likes this.