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
2
Question by Nynex71 · Dec 30, 2010 at 08:43 PM · animationrotationdoor

Door Movement Animation

This is a simple question it seems like but when it comes to unity am i allowed to just make a script that rotates a door while playing a sound or do i have to make the animation?

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

3 Replies

· Add your reply
  • Sort: 
avatar image
3

Answer by DaveA · Dec 30, 2010 at 09:46 PM

Unless the movement is complex enough to be authored (animated with key frames), you might want to look into the 'RotateTo' function. I like that as it lets you adjust how far it rotates, you can easily interrupt, reverse, etc. Use something like what MC HALO has to play the sound simultaneously. You might want to have different sounds for 'open' and 'close' for added fun. Close, for example, might sound more 'slammy' and Open more 'creaky'.

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 MC HALO · Dec 30, 2010 at 10:00 PM 0
Share

good idea dude :)

avatar image
2

Answer by Justin Warner · Dec 30, 2010 at 09:05 PM

You can rotate and play a sound... If you want, make the model of the door, make the pivot at the right spot, then you can just rotate, very easy to do!

Good luck!

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
1

Answer by MC HALO · Dec 30, 2010 at 09:33 PM

i think its easier if you make the door animation and then make a script play it in unity or just run it automatically when you run the game. Here is a simple script that allows you to open a door and play a sound the same time:

this script is using Java:

var DoorOpen : AnimationClip; var DoorSound : AudioClip;

function Update (){

if(Input.GetKey(KeyCode.A)){

animation.Play("DoorOpen"); // This is playing the animation which will be stored in the Animation variable above this will be your door animation.

AudioSource.PlayClipAtPoint(DoorSound,transform.position); // Plays your sound when the door opens

} }

By the way you don't need to make the animation variable you can also put the animation name in there if you like. putting a variable make things a lot neater. This is probably what i would do if want to play a door 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

No one has followed this question yet.

Related Questions

Respawn script and door animation help 0 Answers

Rotation Y axis is bugged. 2 Answers

Door opening in the wrong direction..... 0 Answers

Adding child repositions parent tranform 1 Answer

How do an animation for child objects 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