Search Unity

Hinge joint moving out of place when collision happens

Discussion in 'Physics' started by dennik, Dec 18, 2016.

  1. dennik

    dennik

    Joined:
    Nov 23, 2011
    Posts:
    101
    I've setup a hinge joint and even included limits on its rotation but it ignores the limits and when it collides with another object, its axis springs out of location.
    I really want it to just stop rotating when collision happens (and of course transfer the rotation energy to the object it collided with)
    Is there a way to fix this?
     
  2. Fu11English

    Fu11English

    Joined:
    Feb 27, 2012
    Posts:
    258
    If you have it set up correctly then it's probably a physics accuracy problem. You need to increase the solver iteration count and or decrease the FixedUpdate timestep.
     
    dennik likes this.
  3. dennik

    dennik

    Joined:
    Nov 23, 2011
    Posts:
    101
    It looks like its a solver iteration count issue. Thanks for pointing me to that. It does get a little better when I increase that number however I'm not sure how it will affect the overall performance of the game since I'm using physics everywhere. Maybe I should write a script that helps it avoid going past the collider no matter what
     
  4. Fu11English

    Fu11English

    Joined:
    Feb 27, 2012
    Posts:
    258
    If you use the Configurable Joint instead you can use the Projection settings. This tries to snap things back to the limits if they are exceeded. Just how well it works for your particular case though I don't know, you would have to try it.

    Just another suggestion!

    Also you can change the solver iterations per rigidbody, not just globally.
     
    Last edited: Dec 19, 2016
  5. James-Covalent-Bond

    James-Covalent-Bond

    Joined:
    Feb 1, 2016
    Posts:
    2
    My fix was to disable "Auto Configure Connected Anchor"