Search Unity

HingeJoints2d problem with Angles

Discussion in 'Physics' started by oscarKro, Mar 5, 2019.

  1. oscarKro

    oscarKro

    Joined:
    Jan 13, 2019
    Posts:
    6
    Hello guys,

    This is actually my first post ever on this forum so if this is not the place to ask these questions, let me know.

    A friend and I are building a game for my nephews in which they have to jump and run through levels. Now, for the first time in a long, long time, I've come across a problem I can't seem to solve.

    When you press either left or right arrow keys, the character.transform.rotation.y goes to 0 for right, 180 for left. This works perfectly with our skeleton animations and so forth. The problem arises with our hingeJoints2D. As you can see in the frames, they turn 180 degrees as well. But as a result of that, the angles are wrong and the head for instance moves the wrong direction when they die.

    To give some perspective: I don't use any of the joints when the player is alive, it's all animated then. Only when lives == 0, do i activate all the rigidbodies with their joints on the bones, for it to become a ragdoll. The ragdoll stuf works perfectly when the character's facing right, but not when you're facing left. It seems I can't solve it on my own, maybe somebody else knows?

    greets,

    oscar