• 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 i2pwne · Apr 17, 2013 at 04:51 PM · rigidbodydragdoors

Drag a door to open it

I'm currently trying to program a script which makes door open using mouse dragging, im almost sure theres some rigidbody in the solution..i dont want you to tell me the answer, i just want some hints and i'll figure it up.

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 AlucardJay · Apr 17, 2013 at 05:01 PM 0
Share
  • http://www.google.com/search?btnG=1&pws=0&q=unity+door+amnesia

  • www.google.com/search?btnG=1&pws=0&q=unity+drag+door

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by mikhailovic · Jan 05, 2015 at 05:19 PM

Theese are the steps i took for making my dragable door:

1:Decide with colliders which side of the door you are on.

2:With raycast, make sure to hit the door with GetMouseButtonDown (under a special tag).

3:When the door is selected, disable your Component that looks around so that your camera is freezed. Then with GetMouseButton make it like this: using Input.GetAxis("Mouse X")> or < then 0, depending on if you swipe your mouse to the right or the left add a relative force forward or backwards to your rigidbody door. (Your door should be attached to a hinge joint)

This way you will get fluidity and it will look physically right. You will have to mix with drag and force speed, but the end result is really good.

Hope it helps, and if you get stuck i can post my script, and give you some ideas :)

Comment
Add comment · Show 1 · 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 Romano · Mar 13, 2018 at 12:44 AM 0
Share

3 years later this helped me. $$anonymous$$isses

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.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

14 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

Related Questions

How to Stop a Game Object from Passing through a Collider while it's being Dragged? 3 Answers

Drag Rigidbody 2 Answers

Why does my character fall slowly even though rigid.drag = 0? 1 Answer

Random velocity changes 0 Answers

Moving a rigidbody onto exact mouse position using rigidbody.MovePosition? 1 Answer

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges