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
0
Question by Varjacic · Dec 29, 2015 at 04:16 AM · animationinputcontrolleranimator controllertransitions

Animation transition not recognized while holding multiple keys

HI. I'm trying to animate a character and I have set up an animator controller. I have 2 blend tree states , one for walking and other for running that should transition to "Jump" state and "runningJump" respectively when Space key is pressed. I have boolean parameter isJumping that is on a transitions for jump states. I have this code attached to my character that sets isJumping to true or false.

 if (Input.GetKeyDown(KeyCode.Space))
  {
            anim.SetBool("isJumping", true);
  }
  else 
           anim.SetBool("isJumping", false);

The problem is that jumping states don't activate when holding certain keys. For example, It jumps if I hold W or UP arrow to move my character but if I try to jump while holding W and Q to move to the left it doesn't jump, but if I hold W and D keys to move to the right it jumps. It is other way around if I use arrow keys to move my character (it doesn't jump when I hold left and up arrow). Or when I'm holding SHIFT to make my character run instead of walk the runningJump state never activates.

I have no idea what could be wrong. It could be something stupid but I've been trying to solve this for so long that I don't know where to look anymore.

edit: I tried this on my laptop and it works. It might be that my keyboard sends wrong signals when holding multiple keys or something like that.

Comment
Add comment · Show 2
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 Addyarb · Dec 29, 2015 at 03:18 PM 0
Share

edit: I tried this on my laptop and it works. It might be that my keyboard sends wrong signals when holding multiple keys or something like that.

By "works" do you mean that the same bug appears, or that the bug goes away?

I think what may be happening here is that multiple keys being pressed at the same time is setting line 1 to false.

To be clear, I think that Input.Get$$anonymous$$eyDown($$anonymous$$eyCode.Space) may be read as Input.Get$$anonymous$$eyDown($$anonymous$$eyCode.Space) && !Input.Get$$anonymous$$eyDown($$anonymous$$eyCode.Any$$anonymous$$ey)

To correct this then, you would just make a series of OR statements to check for each possible key combination that would activate your jumping.

That honestly shouldn't be the case, but when you're dealing with a class like Input resolving to a bool, you never know.

Good luck!

avatar image Varjacic Addyarb · Dec 29, 2015 at 04:10 PM 0
Share

By works I meant that bug doesn't appear while using laptop, so I'm guessing it must be something with non laptop keyboard. Thanks for suggestion.

0 Replies

· Add your reply
  • Sort: 

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

problem with animations running then jumping 3 Answers

my animator controller does not work with a certain animation 1 Answer

Animator Controller using Animation Component? 0 Answers

Root motion accuracy issue 0 Answers

Animator Controller - Change State After Time 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