Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 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 artsdcs · Feb 17, 2012 at 06:49 PM · animationdoorkeydoorsopening

door opening

i have searched for this a lot but i can't find it. i am searching for a script where you can play an animation of a door opening then staying open and when pressing e on it again it closes(maybe some fancy sound). it would be helpfull for a lot of people. also, how would you do that in cinema 4d? what i have now is frame 1 to 50 opening animation 51 to 100 closing animation. do i need to put an idle animation in it?

thanks for every one who would like to help.

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 Loius · Feb 17, 2012 at 07:42 PM 0
Share

Did you try searching for "door"? http://answers.unity3d.com/questions/130623/door-animation-after-press-a-key.html

avatar image artsdcs · Feb 25, 2012 at 01:48 PM 0
Share

yes and it doesn't work correctly

3 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Berenger · Feb 17, 2012 at 08:13 PM

You don't need the closing animation, unless it's different, you can play the opening backward. But you need to know the current state (openned, closed, moving)

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

Answer by tomekkie2 · Feb 25, 2012 at 02:00 PM

You don't need to use any frame animation at all. You can easily script the animatior instead.

If these are sliding doors you can use position

 function Update() {
 transform.position = Vector3(Mathf.SmoothStep(minimum, maximum, Time.time), 0, 0);
 }

If hinged

just use transform.eulerAngles.y

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

Answer by deadshot · Oct 20, 2014 at 10:17 AM

using UnityEngine; using System.Collections;

public class door: MonoBehaviour { private int lastindex; public void play() { if(!animation.isPlaying) { if(lastindex==0) { animation.Play("RFdoor"); lastindex=1; } else { animation.Play("RFdoorclose"); lastindex=0; } } }

 // Use this for initialization
 void Start () {
 
 }
 
 // Update is called once per frame
 void Update () {
 
 }

}

this is for playing the right animation.

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

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

9 People are following this question.

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

Related Questions

Door animation after press a key 2 Answers

Opening Door with Key 1 Answer

importing exporting Animation help. 1 Answer

Trying to Open a Door 2 Answers

How to launch an animation pressing e 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