Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 /
  • Help Room /
avatar image
0
Question by Xrystal · Sep 05, 2016 at 06:49 PM · animationanimation controller

AnimatorController use with little or no scripting

Scenario:
I have an object that I want to execute 1 or more animations to based on certain scenarios. I have a fadeIn animation that adjusts the material alpha to fade the object from invisible to visible. I have a fadeOut animation that adjusts the material alpha the opposite way. I have a rotate animation that rotates the object. I want the object to start rotating once a flag is turned on and then stop when it is turned off. This works fine by itself but messes up when using the fading animations. The fadeIn and fadeOut animations should trigger when requested in code but then not loop nor reset. As in once fadeIn finishes it is in a visible state and stays that way until the visibility/fade state(s) are adjusted. Similarly for fadeOut and invisible state.

The problem:
Now, based on what I have read you should be able to simulate this scenario in the animator controller before committing it to code but for some reason it doesn't want to work. Either it stops rotating for no reason or it fades in and out continuosly.

The questions:
1. Is such a scenario possible? 2. Do I have to use the Any State transition to each state animation? I have tried this but it didn't work that way either, so maybe I have misunderstood its use despite all the videos I have watched. 3. Can I use the Any State transition to the fadeIn, fadeOut and rotate animations and then have fadeIn move to Visible and fadeOut to Invisible but keep them there with no other animations triggering? This also seems to be ignored and the animations either stutter part way through or constantly repeat. 4. Or do I have to make sure that every scenario is monitored in script and the code controls when each animation starts and stops. In which case what is the animation controller for if not to control when the animations are run or not.

If someone recognises these problems and can point me to what is causing them it would be appreciated.

Thanks in advance.

Image of Animator Controller Setup At Present

playerpieceanimator.png (47.5 kB)
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 Xrystal · Sep 08, 2016 at 11:35 PM

Well I think I have it figured out. It may not be perfect but it's working the way I expected. Thought I would post my success in reply in case someone else hits a similar bump in their process.

Triggers:

  • Rotate

  • FadeOut

  • FadeIn

Animations:
Rotation - Rotates the animated object on its Y axis using Quaternion (Euler) interpolation with 0:00 set to 0 degrees and x:00 set to 360 degrees. End time set dependent on spin speed required. Should be code changeable if required. Add the following in Start to start the rotating off.

 animController.SetTrigger( "Rotate" );


Screenshot:
Rotate Animator Screen
FadeIn - Fades the renderer material alpha from 0 to 1 over x:00 time based on speed of fade process. It should stay in that final status until the next status change. The following code to placed in the appropriate code block to activate the process. My simple example used the Update routine with a key press to activate it.

 animController.SetTrigger( "FadeIn" );
 while (animController.GetCurrentAnimatorStateInfo( 1 ).IsName( "FadeIn" ))
     isAnimating = true;
 isAnimating = false;



FadeOut - Works similar to the Fade In process except it goes from 1 to 0.

Fade Layer Adnimations


playerpieceanimator-rotate-as-base-layer.png (28.5 kB)
playerpieceanimator-fade-layer-animations.png (32.6 kB)
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

127 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 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 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 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 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 avatar image avatar image

Related Questions

How do I know what animation I can transit to in the animator, from my current animation? 0 Answers

Why is the last frame of the animation not triggering? 0 Answers

Script animation 2d question,Script animation 2d 0 Answers

How do I change the exit time of Animator Override Controllers? 0 Answers

Animation won't play 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