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 /
avatar image
0
Question by Towley · Jun 01, 2014 at 06:35 PM · animationjavascriptdooropen

How to open a door with the "E" key

I have a door that is animated. The door opens from frames 1 to 32, then closes the door at frames 36 to 56.

From my understanding you are able to stop the animation at a certain frame, then start it again when you press your key.

I want to be able to press "E" and the door opens. The animations stops at frame 32. Then press "E" again to close the door. (Start animation at 36 and stop it at 56. Once you close the door. I want to be able to press "E" again and the animation starts again at frame 1.

I have the door rigged and imported into unity. The door is named "Door1".

I am not a programmer. I am an animator and do not know javascript well. If someone could point me in the right direction that would help out tremendously.

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 Towley · Jun 01, 2014 at 06:54 PM 0
Share

I have figured out how to make multiple takes in Unity! I have Take1 (1-32) and Take2 (36-56)

Now I need to figure out how to press "E" and open the door. I just want to make sure it plays in the order of Take1, then Take2, and reset back to Take1.

avatar image kilian277 Towley · Jun 01, 2014 at 08:18 PM 0
Share

Please if it's not a complete answer on your question post it in the comments.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Bolbo13 · Jun 01, 2014 at 07:02 PM

you need to go to your update function and do something like this :

 void Update()
 {
   if(Input.GetKeyDown(KeyCode.E))
   {
      if(isDoorOpen)
         //call your door opening animation
         //set isDoorOpen to true
      else
         //call your door closing animation
         //set isDoorOpen to false
    }
 }

Basically that's the idea.

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 screenname_taken · Jun 01, 2014 at 07:57 PM 0
Share

If you want it for javascript, remember to make it Function Update() ins$$anonymous$$d of Void.

avatar image Towley · Jun 01, 2014 at 08:29 PM 0
Share

Awesome thanks! I figured it out using somewhat of a similar method and it worked out perfect.

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

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

Raycasting fail 1 Answer

on mouse over and at a distance 2 Answers

Door Opening And Closing 2 Answers

Opening an animated door with a keycard 0 Answers

Canceling animation.Play functions after being used 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