Forum rules - please read before posting.

Hinged draggable doors - anyone made one that works? (first person)

Before I go into too much detail I was wondering if anyone has built a reliable hinged door - a full size normal door, like a bedroom door the player can walk through once opened... (using first person controller)

I have 2 problems:

when I grab the door and move mouse left/right to open close.. all seems fine, then it keeps swapping which mouse direction does does what - (left direction was opening door > now its right.. ) - this even happens when I stay in the same position.. just stand there and open and close the door... tried changing "Align drag vector to front". resulted in same consistency.

If I pull the door into the players collider, there is a quick fight between the door and the player - resulting with the door being pulled off its hinges (and maybe the player being popped through a wall... then if you grab the door, give it a quick wiggle, it pops back on the hinge track... (am I right thinking that you are not suppose the set rotation constraints on the rigidbody on the door?)

So before I do any further investigations/explanations - I was wondering if anyone has got this working and I'm just making a mistake somewhere - or was the system never intended to be used for full size doors that can be approached from any direction and pushed pulled into the players collider.... because this isn't a trivial thing to try and do cleanly at all!

Thanks for any input/thoughts.

 





Comments

  • edited May 2018
    I've just recently been working on a door-opening mechanic, and I'm afraid I can only reply in the negative

    In other words, I started out by trying to get a door working according to the tutorial on using the hinged track thingees, but quickly gave up on it, because as you've said, it just seems too... flaky

    The technique I eventually settled on was to have hotspots on both the front and the back of the door, and depending on which one is selected, simply run an Object/Transform Action, to move the door into position over time - inwards if the player has selected the hotspot on the front of the door and is standing outside the room, and outwards if he's selected the hotspot on the back of the door and is standing inside the room. I also keep the state of the door stored in a local popup variable, and check its state to prevent him from opening it if it's already been opened

    (I also close the door automatically behind him, when the player exits a pre-defined trigger area, but that's an extra little nicety)


    The above technique works fine for me, but it doesn't really help in getting a door working using the other method. Sorry


  • edited May 2018
    Uncheck Align drag vector to front? - that is best suited to rotations that occur from a fixed point perspective.  With it unchecked, the required drag direction should account for the object and the camera's rotation.  It shouldn't flip suddenly however - are you holding the door at the same height as the camera.  If you'd like to post screenshots or PM me a test scene file, I can see about recreating the issue.

    So far as the Rigidbody goes, check all Freeze Position / Rotation boxes except for the Rotation axis you want it to move in (presumably Z).  Playing with the Mass / Interpolation fields can also vary behaviour.

    As the drag system relies on Unity's physics engine, the behaviour can be affected by what Physic Material you assign to the draggable object's collider.  Assigning on with a slight Bounciness value (e.g. 0.3) can help with collisions a little.  Tweaking some of Unity's Time and Physics settings can also improve accuracy.

    What is the state of the cursor / free-aiming while dragging?  Are you disabling free-aiming during this time, or having the camera move with it?  Again, if you'd like to post more information about your specific setup, I can see if anything else can be suggested.

    Having a door work correctly in conjunction with e.g. player colliders is indeed a very complex topic.  A dedicated asset that handles this specific scenario may well be better suited here, but this should still be possible in AC - even if not as refined as a dedicated asset.
  • edited May 2018
    I also tried, and at the end just gave up ... the best way for me, as I had a situation with doors and many drawers is Hotspot on the door object and then variable with Object: transform actions ( with parameters if necessary) or simply, animation.. do  the work just fine.  If I would want to have something like "drag effect" like in the amnesia games, with physics engine and rigidbody, well, that could be a little tricky but it could be done with some tweaks
  • Thanks very much for your input, both of you, I'll post up more information as soon as I get chance.

    Off the top of my head:
    > I am disabling free aiming..
    > haven't changed physic materials from the original settings..
    > the grab position is about in line with the camera.. I'm going to check if the height of the grab position has an affect on the issues originally raised.

    Doors are always a pain in the arse - especially first person... and yeah a dedicated bullet proof asset here would be a great way to go... or as HarryOminous has done, use hotspots.

    It's always the same - involve physics in your game and it'll work 95% of the time how you want - but when the 5% happens it usually results in game breaking nastyness.


    I'll do a stripped-down bare minimum test, and post that to you if I still can't get it to work.





  • edited May 2018
    Indeed - physics in Unity can be notoriously tricky sometimes, and involving player colliders as well only compounds the problem.

    Let me know how results vary when the grab position is above / below the camera, as opposed to roughly the same height.  In the upcoming release, I'll be making some minor tweaks to the class structure to allow for custom drag types to be written for those that might dare to attempt it.

    One thing that I think would improve things slightly would be to have the first-person camera face the "grab point" at all times, which can be done via a simple script I've added to the wiki here:


    EDIT: Seems this too has some issues related to FPS head-tilting.  This will be addressed in the upcoming update.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.