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 /
This question was closed Apr 30, 2014 at 11:06 AM by thornekey for the following reason:

Duplicate Question

avatar image
-1
Question by thornekey · Jul 01, 2013 at 09:18 AM · doorshowto

How do i make a 2 part door that opens and closes vertically?

How do I make a 2 part door (as in 1 half on top and the other on bottom (different objects inside a gameobject) and make it so that when another object ( a button of some kind) is pushed the top door piece goes up and the other down?

Comment
Add comment · Show 2
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 killer-zog · Jul 01, 2013 at 09:27 AM 0
Share

use ontrigger animation, so when someone activate the the ontrigger event the animation will play, the animation should have two part one is for the upper part and the other one is for the down part.

avatar image thornekey · Jul 01, 2013 at 09:31 AM 0
Share

can you write a quick example script for me?

1 Reply

  • Sort: 
avatar image
2
Best Answer

Answer by theAfrican · Jul 01, 2013 at 10:11 AM

1) Create an empty game object(doortrigger) which parents upperdoor and lowerdoor.

2) Give it an animation Component.

3) Create the animations "openlowdoor","opentopdoor" for doortrigger

4) attach a box collider to doortrigger and make sure you set "isTrigger" to checked.

5) attach the script below to doortrigger gameobject

 function OnTriggerEnter(c:Collider)
        {
        if (c.tag=='Player')//give your player any tag if you want the animation to start when ur player is close
            {
            animation.Play("opentopdoor");
            animation["openlowdoor"].layer=1;
            animation.Play("openlowdoor");    
            }
     }
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 theAfrican · Jul 01, 2013 at 12:37 PM 0
Share

you create an empty gameobject. give it a box collider and set it around the door, say 2m apart in and out of door. add that script to it. lemme edit answer so as you can just add the door objects

avatar image Kiloblargh · Jul 02, 2013 at 03:47 PM 0
Share

You're not going to get far in Unity, or in life for that matter, waiting for someone else to write every script you need. What you're trying to do is pretty basic and has been asked many many times here. The help theAfrican already gave you was generous, but if you had RTF$$anonymous$$ in the first place; you would have seen OnTriggerExit right after OnTriggerEnter. Stop begging, start learning.

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 script a door opening with points...please help 1 Answer

Moving Objects along a vertices 1 Answer

Door opener 1 Answer

looking for help with item pickups 1 Answer

Script to make an enemy follow the player when they trigger a door? 0 Answers


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