Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 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 /
This question was closed Aug 24, 2017 at 02:25 AM by SirBedlam for the following reason:

Too subjective and argumentative

avatar image
-2
Question by SirBedlam · Jul 01, 2014 at 08:40 AM · physicsdragclickdoor

Draggable Doors Like Amnesia?

What would be the best way to go about creating click-and-drag doors like the ones in Amnesia (which actually function the same)? This means they would behave realistically with continued movement after mouse release, and damping that slows them down appropriately.

I have been trying to put together this feature for over 2 months now, and nothing works. I have read ALL the questions and answers and forum posts on this topic, and have tried Configurable Joints as well as different scripts (such as DragRigidbodyShadow and others I've found on the forums). However, these Configurable Joints in my experience have been very buggy and unpredictable, and seem to do whatever they want regardless of how you set them up.

Well, asking here is my last resort, as I simply cannot figure out a way to pull this off. What I'm looking for is an example to go by, because not only am I terrible with interpreting explanations without examples, I've also exhausted all my ideas.

I do have a script I've been trying to write for this, which I've customized to let me clamp the pitch and volume of a repeating door creaking loop based on a float value of the current speed at which the door is turning. I also have functions which trigger the opening and closing sounds. However, I've decided at this point that I need to go about achieving this draggable door feature a completely different way (again). So, instead of trying to work from the unsatisfactory progress I've made so far, I think it would be best if I just started with a clean slate, implementing them in whatever way would work best.

TL;DR: I'm looking for a way to achieve draggable doors like those in Amnesia, meaning they:

  • Must be clicked on and "dragged" to open, either with the mouse or by stepping backward, as long as the player is still holding down the mouse button.

  • Respond appropriately to the set limits, and don't glitch around if opened too quickly.

  • Stick to the "minimum" limit (closed position) once it's reached, and must be clicked and dragged again to re-open.

Can someone please help me out with this? It's been quite a while since I started trying to achieve this, and since then I've gotten absolutely nowhere.

EDIT: Cleaned up and re-worded

Comment
Add comment · Show 8
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 Klarax · Jul 01, 2014 at 09:15 AM 0
Share

im guessign here as i've never done it, but i would try a hinge at a point of the door as required, and then use the drag script from community scripts site

http://wiki.unity3d.com/index.php?title=DragObject

avatar image Tanshaydar · Jul 01, 2014 at 10:17 PM 0
Share

I have a mechanic which is honestly working better than Amnesia door mechanic. I also implemented a drag object mechanic. I'd say keep messing with rigidbody and joint mechanics to have something to your taste.

avatar image SirBedlam · Jul 13, 2014 at 02:01 PM 0
Share

I have kept messing with them, that's why I'm finally just turning here for help. Nothing I've tried has worked.

avatar image Tanshaydar · Jul 13, 2014 at 02:57 PM 0
Share

Something like this?: http://www.youtube.com/watch?v=gfRu7olj79E

avatar image SirBedlam · Jul 23, 2014 at 12:38 AM 0
Share

Yes! The door behaviors in that video are actually exactly what I'm ai$$anonymous$$g for. It doesn't matter what I do, though, it's always just a glitchy mess. It's really annoying how most things that are so simple and have been done so many times before always just end up being oddly impossible for me to achieve. :/

Show more comments

1 Reply

  • Sort: 
avatar image
1

Answer by KMKxJOEY1 · Aug 21, 2014 at 12:56 AM

here is a snippet from something relatively similar:

 else if (activeTool == Tool.Rotate && mouseDown)
         {
             float deltaX = (mouseStart.x - Input.mousePosition.x) / 3f;
             activeEditObject.transform.eulerAngles = new Vector3(activeEditObject.transform.eulerAngles.x, deltaX + startRot, activeEditObject.transform.eulerAngles.z);
         }

Plug and chug buddy; basically when MouseDown event is called save the mouseStart vector to a variable, then rotate it based on the current mouse position until the MouseUp event is invoked. Be sure to check that the mouse is over the door when you check the MouseDown event :)

Ofc you need the transform root to be the hinge in order for the door to rotate properly.

Happy coding.

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 Cherno · Aug 21, 2014 at 07:56 AM 0
Share

This answer sounds reasonable. About the original question: I don't like the lack of formatting, specifically the lack of any paragraphs, that everything is in one big, hard-to-read text block, and that half of the sentences sound like rants about a perceived lack of tutorials for this feature.

avatar image SirBedlam · Sep 20, 2014 at 01:19 AM 1
Share

Thank you. It's been a little while, but as soon as I'm able to I'll try this.

Follow this Question

Answers Answers and Comments

25 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

door animation physics 1 Answer

Drag acting over rigidbody 2 Answers

Is there a way to click on a render texture to select soemthing within the view? 4 Answers

Can I have a rigidbody continue to calculate physics while being dragged by code? 2 Answers

Can't click gameobject when over another trigger? 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