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 /
avatar image
2
Question by fafase · Apr 05, 2016 at 11:54 AM · animationanimator

Animator - Animation State normalizedTime is not normalized

Normalized value is meant to be between 0 and 1.

    void Update()
 {
     AnimatorStateInfo asi = GetComponent<Animator>().GetCurrentAnimatorStateInfo(0);
     float norm = asi.normalizedTime;
     Debug.Log(norm);
 }

Amazingly (or most likely sadly...) this will display anything from infinite negative to the opposite.

I have difficulty this is meant to be this way. Or someone needs a refresh on normalized value.

I am still using 5.3.3 so is this part of the whole "We screwed it all" version or is it still in the latest one as well and honest...that can't be...

I understand I can't add some code to check and stop the animation but this is just pure solid gold rubbish.

Comment
Add comment · Show 5
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 meat5000 ♦ · Apr 05, 2016 at 11:58 AM 0
Share

That code throw you no errors? :) Perhaps a CS0119? :P

Anyway, did you set the start and end frames of the clip to be different to the default in the Anim Import?

avatar image fafase meat5000 ♦ · Apr 05, 2016 at 12:02 PM 0
Share

Nope no error, the missing parenthesis is a typo. I created the animation myself, it is a basic movement of a UI.

avatar image meat5000 ♦ fafase · Apr 05, 2016 at 12:04 PM 0
Share

Ah so its made with the Animation window? Do you have an external animation, say from 3DS$$anonymous$$ax or Blender to try?

Show more comments

2 Replies

· Add your reply
  • Sort: 
avatar image
3
Best Answer

Answer by NosVidz · Apr 05, 2016 at 12:11 PM

Normalized value is meant to be between 0 and 1.

Where did you get that from? Normalized vectors have a magnitude between 0 and 1, yes. But normalizing doesn't mean putting everything between 0 and 1. http://docs.unity3d.com/ScriptReference/AnimatorStateInfo-normalizedTime.html The integer part is the number of time a state has been looped. The fractional part is the % (0-1) of progress in the current loop. So if your normalized time is > 1, you finished your animation at least once.
Comment
Add comment · Show 6 · 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 fafase · Apr 05, 2016 at 12:17 PM 0
Share

Ok so it is not normalized as normalization which consists in setting a value within a range, most likely between 0 and 1. True you can normalize to anything but by default you assume 0 to 1.

In that case the fractional part is the normalized value. Funny, the value keeps growing even though my animation is stuck at the end.

I would have thought that because of the na$$anonymous$$g it would be obvious.

avatar image meat5000 ♦ fafase · Apr 05, 2016 at 12:47 PM 0
Share

In an imported animation you get to specify if the animation loops or not. Where can you do this in an Animation Window-created animation?

avatar image fafase meat5000 ♦ · Apr 05, 2016 at 02:58 PM 0
Share

When you select the Animation in project panel, it shows some basic information. There is loop toggle.

avatar image meat5000 ♦ · Apr 05, 2016 at 12:42 PM 0
Share

This doesnt account for the -infinity though. Or do you think this is either a product of a Frame 0 animation or a very small decimal?

avatar image SandLantern · Jan 03, 2019 at 08:30 PM 0
Share

I almost was going to call you out on being against the documentation, when I realized that I was getting AnimatorStateInfo mixed up with AnimationState which treats normalized time as a different thing. Unfortunately when I googled AnimatorStateInfo that was one of the top results so I ended up in the wrong place. To future Googlers, beware. There IS a difference!

avatar image npatch · Feb 11, 2019 at 02:35 PM 0
Share

The fact that Unity also packs a separate piece of information to the same value doesn't mean it changes what normalization means. If you disregard the loop iteration part (or if you have an animation that's not looped) you still get 0-1 as you expected. If you look into normalized position in ScrollRects, you also get 0-1. It could be a different range(like 0-100) but it's more convenient to keep it in 0-1 as you get the same level of intuition but you don't need division(curr value / max value) before using the value itself. It's understandable to expect just that. Anything else is just an exception(and I guess this packing is also a matter of convenience).

avatar image
3

Answer by FrostFT · Apr 06, 2018 at 02:53 PM

I think it mean normalizedTime return value > 1 beacause animation is looped. You can get fractional part of float like this:

 float norm = asi.normalizedTime % 1;

It will be between 0..1

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

79 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

Related Questions

2D Animation does not start 1 Answer

Animator parameter does not pick the value of the animation curve with the same name 2 Answers

Animation not looping 1 Answer

Multiplayer - Host's animation stops but client's doesn't. 0 Answers

Create animation transitions via script. 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