How to make a door like the ones in Amnesia: The Dark Descent

I am making a first person game that takes place mainly in hallways and buildings, and as such, I need to have doors. I want to make the doors like the the ones in Amnesia: The Dark Descent, by which I mean that if you click and hold down the left mouse button on a door, then the door opens away from you slowly as you slide the mouse forwards, and the opposite happens if you slide the mouse backwards. I am not very experienced (and just plain bad) at scripting, so is there a script that I could use? Any suggestions would be appreciated greatly.

There isn't a certain script you can use I'm afraid. The only thing I can suggest is that you try breaking what you want to do down into smaller and smaller steps, and work out how to acheive each one in turn. For example, you may decide to break it down as follows:

  • Import the model of the door (and wall?) from your choice of 3d modelling package into Unity
  • Detect when the player presses the left mouse button down
  • Work out whether the mouse pointer is over the door handle when it is pressed
  • Track the change in vertical position of the pointer while the button is down
  • Move/animate the door based on how far the mouse has moved

Use Configurable Joint. It was made for doors.

With DragRigidBody script ^^