Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Alex Wigle · Apr 09, 2011 at 09:50 PM · door

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.

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Jessy · Apr 09, 2011 at 10:02 PM 2
Share

Don't say you're bad at scripting. It's negative thinking and only serves to make you think you can't do things that you can, with practice.

3 Replies

· Add your reply
  • Sort: 
avatar image
3

Answer by Wibbs 1 · Apr 09, 2011 at 11:26 PM

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
Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Joshua · Apr 27, 2011 at 02:40 PM 0
Share

These are all extremely simple steps though, coding wise. All but step one can be done in a single line of code each.

avatar image poncho · Apr 27, 2011 at 02:40 PM 0
Share

very nice answer, i suggest the detection with trigger and the trigger box, then the mouse recognition this way, the player object needs to be on range of the door, then make the interaction with the mouse, thumbed you up

avatar image
0

Answer by xylax · May 04, 2012 at 07:15 AM

Use Configurable Joint. It was made for doors.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by Kirbyrawr · Aug 01, 2012 at 11:16 AM

With DragRigidBody script ^^

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

2 People are following this question.

avatar image avatar image

Related Questions

Toggle button help 1 Answer

Scripting Mulitple Doors, One Key 1 Answer

Sliding door animation question. 3 Answers

Player wont be found on start 1 Answer

Two sounds from one keypress 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges