Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Barricading doors? Help!

Discussion in 'Animation' started by jorn818, Dec 1, 2014.

  1. jorn818

    jorn818

    Joined:
    May 12, 2013
    Posts:
    97
    I have doors that open when you trigger the door, but I want the animation to stop working if the door is barricaded on the other side for example: if I would drag a closet infront of the door i don't want people on the other side to be able to open the door, but when Someone is on the other side the door goes through the object, so I want the animation to stop midanimation when colliding and go back to its idle state. (this way it won't cause buggy clipping) if this isn't possible an alternative would be to have an object bigger than a certain trigger (so a dropped gun won't work) be put inside the trigger and when its inside the animations don't work anymore till that object is away from the trigger (ofcourse there should be an exception for players)
     
  2. TMPxyz

    TMPxyz

    Joined:
    Jul 20, 2012
    Posts:
    765
    What about you make the door with rigidbody and collider, then let the physx to handle the block?

    This could be easy, and you can use layer to control what will collide with the door, and what will not.
     
    theANMATOR2b and jorn818 like this.
  3. jorn818

    jorn818

    Joined:
    May 12, 2013
    Posts:
    97
    The problem is the door would bug out so I still would need a script that stops the door animation on collision
     
  4. TMPxyz

    TMPxyz

    Joined:
    Jul 20, 2012
    Posts:
    765
    You could try playing with the parameters of the HingeJoint, it's tricky, you could watch the tutorial at the unity3d.com/learn.

    If you want to make the door stop at the full-open position, you could put a collider with script at the full-open position, and stop the door when collide with that.