Search Unity

Problem with Hinge Joint and Collider.

Discussion in 'Physics' started by AllBark, Mar 15, 2018.

  1. AllBark

    AllBark

    Joined:
    Oct 30, 2015
    Posts:
    4
    Quick rundown. I've got a mesh for a gate that I'm trying to get a hinge joint working on. I want the player to be able to push the gate open. I attached a Collider to the gate door so it can interact with the player. At runtime the player moves straight through the mesh of the gate. When I pause and zoom in I can see that the Collider has hinged as expected but the mesh hasn't moved with it. Any ideas?

    FYI, I have an armerature attached to the mesh from when I was playing with the door in blender, and in case I wanted to animate it. Could the animator be messing with the hinge joint?
     

    Attached Files:

    • bug.png
      bug.png
      File size:
      1.1 MB
      Views:
      846
  2. StickyHoneybuns

    StickyHoneybuns

    Joined:
    Jan 16, 2018
    Posts:
    207
    Where do you have the hinge joint attached? I don't think its the animator that's messing with it, I think it's the armerature you have attached to it. Try removing the armerature then reimporting your model, then attach a hinge joint. Or, you could just easily make an animation to do the same thing.

    Edit: If you have the hingeJoint on the armerature it should work assuming you have it setup for animating the object.
     
  3. AllBark

    AllBark

    Joined:
    Oct 30, 2015
    Posts:
    4
    I have the anchor for the joint where the hinge would be for the door. The hinge component is attached the mesh of the door though. I can try attaching it to the bone of the door instead. I assume the rigidbody and box Collider would need to be on the bone as well? If it doesn't work I'll just rip out the armerature and try that. t just didn't want to have to reimport anything. =p

    At work right now so it'll be a few hours before I can try it.
     
  4. StickyHoneybuns

    StickyHoneybuns

    Joined:
    Jan 16, 2018
    Posts:
    207
    Yea, so that is most likely your issue. I don't think the box collider and mesh have to be on the bone directly. Try just attaching it to the bone and see what happens. The mesh and collider should follow if my thinking is correct. If it doesn't work you can always post a screenshot showing the hiearchy of your object.
     
  5. AllBark

    AllBark

    Joined:
    Oct 30, 2015
    Posts:
    4
    Ended up having to rip out the armerature completely. Attaching it to the bones was doing weird stuff and flinging the whole mesh into Oblivion lol got it working now though! Thanks for your help.
     
    StickyHoneybuns likes this.