• 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 Jusfowle · Jul 04, 2013 at 08:34 PM · animationmovementobjectenvironmentambient

How to Animate Environment Objects

I have been tasked with making a playable environment within a game engine for a class project. I am new to Unity, although I have been watching tutorials and using it for a few weeks. I have several years of experience working with Maya, and I have a basic understanding of the workflow between Maya and Unity. I already have environment objects completed with animation and have assembled the scene in Unity. The ambient objects that only require a portion of the object to rotate or translate work fine, such as a fan or a flag. However, when it comes to objects that move within the environment, I am not sure on the best approach to animation. I have a basic understanding of Mechanim, but I am not certain how this applies to animals or organic environment objects.

I have a crow with a basic wing flapping animation that I want to circle overhead in a loop. Would it be best to animate the translation and rotation using Unity's tools and leave the Maya animation for the wing flapping?

In addition, I have an animated tumbleweed with a rotation and translation that I want to roll from one corner of the terrain to the other. However, the Maya animation only covers a short distance and looping the animation returns the object to its original location in 3d space to start again. Would I need to extend the Maya animation to cover the length of the level or is there a more efficient approach?

What is the best approach to animating environmental objects within Unity?

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 Kiloblargh · Jul 04, 2013 at 08:43 PM

The best approach IMHO is to animate as much as you can with scripting. If something will be moving in a fixed way, you should animate its looping behavior relative to its own center and then move that center with an animation curve in Unity.

But It sounds like you're still thinking inside the pre-rendered 3d animation box from your years of Maya experience.

The crow can come and go, it can perch on a tree and be scared off when the player arrives. The tumbleweed doesn't need to roll across from point A to point B and loop; you can make tumbleweeds of all sizes and colors spawn randomly and roll by using rigidbody physics or even a particle system.

If the crow's circling, it shouldn't look like it's a stage prop hanging from a mobile, it should be rising up one thermal and swooping to catch the next.

All this is more work, but it's what Unity does well that Maya doesn't. If the point of the class is creating interactive environments; the behavior of every entity you put in that environment is very important: do they even have behavior, or is it essentially just a short film that you can walk through?

Comment
Add comment · Show 3 · 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 Jusfowle · Jul 04, 2013 at 09:18 PM 0
Share

Thank you for your feedback. I see that these animations would be better as scripts than as pre-rendered animations. Do you have any links to resources that might cover this type of behavior?

These objects do not have to be interactive. They are considered ambient entities for the purposes of the class. Other objects such as moving platforms have to be interactive, but I have already created scripts to trigger these animations based on the player's proximity. The assets in question are merely for the aesthetic value.

avatar image Kiloblargh · Jul 04, 2013 at 10:23 PM 0
Share

You can quickly get what appears to be complex behavior with well-constrained randomness. Invoke and InvokeRepeating, Random.Range, and switch / case statements are all you really need as a beginner; that and an unlimited supply of coffee. But the basic idea is that any variable you could hand-set in the inspector, you could just as easily roll the virtual dice on at runtime.

Does the following make sense to you?

 function RollTheDice ()
 {
 var roll : int = Random.Range (0,12);
 switch (roll)
     {
     case 0:
         DoThis();
         break;
      case 1:
        DoThat();
        break;
      case 3:
      case 4:
      case 5:
        DoSomethingElse();
        break;
      }
 Invoke ("RollTheDice", Random.Range (0.2, 2.0) ); 
 }



avatar image Jusfowle · Jul 07, 2013 at 09:35 PM 0
Share

Yes, this is great. I ended up creating simple scripts for translation and rotation for the purposes of my assignment, but I will keep this in $$anonymous$$d for more complex behavior. Thank you for all of your help!

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

15 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

Related Questions

How can I make a ball dribbling like in NBA 2K? 0 Answers

scripting for animation 0 Answers

Mirroring Object Movement with Mouse Position 2 Answers

Mecanim blend moves character? 1 Answer

How to get an Objects position per axis? 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