Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Hinge joint glitch, i can not fix it

Discussion in 'Physics' started by impheris, May 1, 2023.

  1. impheris

    impheris

    Joined:
    Dec 30, 2009
    Posts:
    1,622
    Hi guys..
    I'm trying to make a simple door, i've seen some youtube videos and it works in everybody's videos but not in my case, For example:


    I'm doing exactly the same as this guy but look at my video:


    This are my settings:
    sfgfs.jpg

    And the anchor:
    cdgh.jpg

    Is that normal? is there a better way to do this? am i missing something?
     
    Last edited: May 2, 2023
  2. bobadi

    bobadi

    Joined:
    Jan 3, 2019
    Posts:
    660
    quick guess: try adding fixed joint (door frame / parent object) for the hinge joint connected body
     
  3. impheris

    impheris

    Joined:
    Dec 30, 2009
    Posts:
    1,622
    Hi, thank you for your help, do you mean creating and object then add a fixed joint to that object and then add that object to the "connected body" component of the door with the hinge joint?
     
  4. bobadi

    bobadi

    Joined:
    Jan 3, 2019
    Posts:
    660
  5. impheris

    impheris

    Joined:
    Dec 30, 2009
    Posts:
    1,622
    yes, thanks i tried that, it did not work, but i'm using now configurable joint and the "glitch" effect still there but is a bit less
     
    Last edited: May 2, 2023
  6. bobadi

    bobadi

    Joined:
    Jan 3, 2019
    Posts:
    660
    one more thing you could try. sorry I meant to say before

    what if you add a simple kinematic rigibody object for the connected body (instead of fixed joint)

    because what I see is your door is being moved by the character controller. is not what you are trying to fix?

    also I think the hinge joint axis shouldn't be 90. it's 1 or 0, afaik
    Axis The direction of the axis around which the body swings. The direction is defined in local space. so it's a direction vector, you specify based on how your model stands.
    one more thing is strange on that rigidbody. shouldn't you freeze rotation on some axes? (maybe not needed)
     
    Last edited: May 2, 2023
  7. impheris

    impheris

    Joined:
    Dec 30, 2009
    Posts:
    1,622
    Yes i want to open the fence with the character, like pushing it, that is working good, the problem is the "glitch" i showed in the video jaja i think is because the limits and the effect caused by the physics with the character and the way Unity is handle it on the frames. So, i put some transparent boxes on each limit to for the fence to not move, is kind a cheap way to fix it but is "working" better
     
  8. tjmaul

    tjmaul

    Joined:
    Aug 29, 2018
    Posts:
    467
    You’re walking into the hinge and since your player is a kinematic object, you’re creating a situation that can’t be solved by the solver, resulting in the vibrating behaviour. You can either make your character move using addforce so it’ll respond to being pushed back by the door and/or embed the door in an actual scene where the hinge is connected to a post or a wall that the character can’t penetrate.
     
  9. impheris

    impheris

    Joined:
    Dec 30, 2009
    Posts:
    1,622
    The door is connected to a wall on that video, but the wall is "invisible" there is no different tho
     
  10. tjmaul

    tjmaul

    Joined:
    Aug 29, 2018
    Posts:
    467
    No I meant a wall that the player can’t penetrate. You’re walking through the actual hinge with your player, which creates a problem without a solution:
    The hinge tells the door that it should be in one spot and the player collider tells it that it can’t be there. The hinge and door and the interaction work as intended as far as I can see.