• 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
Question by JonK · Aug 11, 2013 at 06:47 PM · animationmecanimtransitionanimation-blending

Mecanim - transition from run to jump

I'm trying to have the character transition from run to jump when the jump button is pressed but it often doesn't transition to the jump animation. It instead continues to play the run animation while in the air.

If anyone can tell me why this is happening that would be great or if there is a better way of doing this.

This is the whole Layer

alt text

This is the transition from run to jump

alt text

mecanim 1.png (71.4 kB)
mecanim 2.png (15.2 kB)
Comment

People who like this

0 Show 3
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 Benproductions1 · Aug 11, 2013 at 11:20 PM 0
Share

Does this only happen when you try to transition from Run to Jump or does this "bug" also happen when you try to transition to the other jumps?

Also make sure that "Jump" is actually true when you "Jump"

avatar image JonK · Aug 12, 2013 at 03:44 AM 0
Share

I get the same result for walking and Jump is true every time Jump is pressed.

avatar image Benproductions1 · Aug 12, 2013 at 03:58 AM 0
Share

Could it be that your jump is only true "as long as" jump is pressed? Meaning it's related to the "key" and not the acctual character?
Perhaps you should heck wether the character is on the gound instead :)

1 Reply

· Add your reply
  • Sort: 
avatar image
Best Answer

Answer by JonK · Aug 12, 2013 at 04:39 AM

I was checking this way

        bool grounded = CM.IsGrounded;
         anim.SetBool("isGrounded", grounded);
         
         if(grounded)
             anim.SetBool("Jump", false);
         
         anim.SetBool("Falling", CM.Falling);
         
         if(CM.Falling)
             anim.SetBool("Jump", false);

I changed it to this

      if (currentBaseState.tagHash == jumpState)
         {
             
             if(!anim.IsInTransition(0))
             {
                 anim.SetBool("Jump", false);    
             }
         }

It now works 100% of the time but will sometimes play the run animation in the air for a few fractions of a second.

Is there a way to transition from one animation to another from any point in the animation?

i.e. if I jump at 0.1 sec into the run animation or at 0.25 sec into the animation I will get the same results.

Comment

People who like this

0 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 Benproductions1 · Aug 13, 2013 at 01:20 AM 0
Share

Mark the answer as correct :)

I suggest splitting up the animation into seperate clips, so that you can transition back from each. This avoids having very weird transitions

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

16 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

Related Questions

Nicer Mecanim transitions? 1 Answer

How to fluently transition into an animation state? 0 Answers

Triggering an animation once in mecanim 4 Answers

Mechanim Trigger Issue 1 Answer

mecanim trasitions auto reset 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