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
1
Question by UltraSage · Oct 18, 2019 at 01:28 AM · animationanimatoranimation controller

Precise animation control

I have a really basic animation controller setup with character being able to stay idle, run and jump. It's all controlled with two bools: Move, and Jump. alt text I can easily control execution of the animations, but I don't know how to control them precisely.

What I mean is that when I for example introduce the jump and then start playing and continously jumping, the animation will soon fall out of synchronization with the player avatar, and the jumping animation will end and loop during middle of the jump. Also because of this, sometimes when continously jumping and moving, a running animation will play for about half a second during the jump.

My question(s) is: How to get a proper grip on animation control and fix these issues? As far as I understand, the animation isn't fully synchronized with the physics, but instead of trying to match the animation and jump time can I just somehow absolutely force the animation to be at 0 time everytime I start jumping? Are there any tips or proper handling techniques to prevent this kind of behaviour?

unity-2019-10-18-03-01-41.png (14.7 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

4 Replies

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

Answer by UltraSage · Oct 28, 2019 at 04:54 PM

So, I have found solution to my problem. Adding it couple of days late, but It'd be nice to close the question with the definitive answer;

Manipulating the transition did not work the way I wanted. Whenever movement button was pressed while jumping animation was over 50% done, the avatar would either play the running animation or freeze for about half a second. Disabling exit time would often result in running animation playing when character was still in mid air.

What fixed the jumping issue was the Animator.Play() function along with some intelligent movement handling, which let me force jump animation to be played from frame 0 whenever player starts jumping, and force idle animation whenever player is supposed to land without any momentum and running right after. This works for me, because the jumping animation doesn't look unnatural when played instantly from any given state. And it's almost perfectly synchronized with the physics. To estimate what state the animation is in I used animation events system.

With those two utilities I am able to get the control I wanted whenever the stock mecanim controls fail me due to weird transitions or something else.

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 Pangamini · Oct 21, 2019 at 10:39 AM

You can control the exact time position of the animation state. Select your animation State, tick "Normalized Time" and then you'll have an option to fill in the float parameter which will control the position of the animation clip when this state is playing. This means that you'll be responsible to increment this value over time using animator.SetFloat().

Optionally you could construct your own 'animator' using the playables framework, but that's much more work

Comment
Add comment · Show 2 · 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 Pangamini · Oct 21, 2019 at 06:17 PM 0
Share

Another option would be to have a transition to "Jump" from "Any State", including self (transition to self) perhaps also allowing the transition to interrupt other transitions

avatar image UltraSage · Oct 28, 2019 at 04:35 PM 0
Share

That's an interesting approach, I was not aware of "normalized time" functionality. I have it already solved, but that sounds like an approach that could work for me.

avatar image
0

Answer by Arshww · Oct 18, 2019 at 03:41 AM

Hi @UltraSage, have you tried unchecking the Has Exit Time property? otherwhise, for example, if you are running and then jump, the Jump animation will wait until running animation ends: click those white arrows and try unchecking, you can read more about it here: Animation Transitions.

Has Exit Time : Exit Time is a special transition that doesn’t rely on a parameter. Instead, it relies on the normalized time of the state. Check to make the transition happen at the specific time specified in Exit Time.

Plus, i suggest you to link the Jump animation to a trigger instead of a bool

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 UltraSage · Oct 28, 2019 at 04:31 PM 0
Share

Yes, I have. That was the first thing I did. Unfortunately it didn't happen. Could you elaborate on advantages of using trigger ins$$anonymous$$d of bool in this case?

avatar image
0

Answer by suIly · Oct 20, 2019 at 04:47 PM

Uncheck Exit Time and set the transition duration to 0

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 UltraSage · Oct 28, 2019 at 04:31 PM 0
Share

Unfortunately this did not give me the result I wanted.

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

306 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 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 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 can I change my AnimatorState instantly? 1 Answer

16 identical Mecanim Animator errors....why? 2 Answers

Is posible to make an universal transition tree for many GameObjects? 1 Answer

Play one animation after finishing another animation using bool variable. 0 Answers

Controlling an Animation's playback through the Animator Component? 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