Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 jg2115 · Jun 25, 2013 at 08:12 AM · animationphysicsdoor

door animation physics

I made a door with open/close animations and a box collider. Everything works fine except when you stand in front of the door in its path and click to open/close it passes right through you.

Comment
Add comment
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

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by TonyLi · Jun 25, 2013 at 02:48 PM

The animation is modifying the mesh and/or one or more "bones" (child objects) in the door's "skeleton," depending on how the animation is set up. The box collider is tied to the main game object, so it doesn't follow the mesh. In the Scene View, select the door. You should see a green wireframe representing the box collider. When you open the door, you'll probably see the door mesh move but the collider stay in place.

One way to fix this is to attach a collider to one of the child objects that actually get moved in the animation, and get rid of the collider on the main game object.

Another way, depending on your needs, is to change the shape of the collider so that it represents the open door position when you open the door. (Or have two colliders and enable/disable them as you open/close the door.) This will allow the door to pass through you while it's opening -- but, once open, you can't walk through the door mesh. From a user interface standpoint, this is sometimes nicer because the door doesn't try to shove you out of the way as it's opening.

And yet another way is to use a Hinge Joint.

Comment
Add comment · Show 15 · 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 jg2115 · Jun 25, 2013 at 03:24 PM 0
Share

The door is the child of the hinge. The script for opening and closing and the animations were added to the hinge. The box collider for the hinge covers the whole door. You cant walk through the door when it is open. The problem is if you are between the closed door position and the open door position and you click to close/open it, it passes right through you.

avatar image jg2115 · Jun 25, 2013 at 04:00 PM 0
Share

On a hinge joint what makes the hinge spin?

avatar image TonyLi · Jun 25, 2013 at 04:54 PM 0
Share

If you put the collider on the door ins$$anonymous$$d of the hinge, does it follow the door?

To me, it's really a design decision as to whether the "problem" is really a problem. When I'm playing a game and run up against a door and press a button to open it, I don't like when I have to manually step back to allow the door collider to swing open. For smoothness of gameplay, I don't $$anonymous$$d if the door swings through my character. It does bother me, on the other hand, if I can walk through the door mesh once it's already open. At that point I think it should be solid.

For the hinge joint, you use physics ins$$anonymous$$d of animation. You can apply a force with the motor property.

avatar image jg2115 · Jun 25, 2013 at 04:59 PM 0
Share

so could you make it so you could drag it open but it doesn't have to be dragged to a particular position?

avatar image jg2115 · Jun 25, 2013 at 05:04 PM 0
Share

What would I need to do once I add a hinge joint so that I could drag it open?

Show more comments

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

17 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

Related Questions

How to stop first person player from walking through animated door 1 Answer

Rotation Y axis is bugged. 2 Answers

Begginers question, Simplifing a script, opening two doors with 2 overlapping triggers. 1 Answer

How do you make ripples for character in water? 0 Answers

Created an Open Close Animation, but script wont activate both doors? 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