Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 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 IonoI · Jun 22, 2015 at 03:50 AM · playerjumpcontrolsgetkeydowngetbuttondown

Jumping not allways registering fix?

Sometimes when I press spacebar the game completely ignores it. It seems to ignore my jump button once every 5-10 jumps, sometimes more than once in a row. It can happen any time, doesn't matter if i'm standing still or if I havn't jumped in a while. Building the game does't fix it. My player object(ball) has sphere collider, meshrenderer, rigidbody, and character controller if it matters.

how can I make jumping respond 100% of the time?

this is in the LateUpdate method:

             if (Physics.Raycast (playerT.position, -Vector3.up, 0.6f)) {//is grounded
                 if (Input.GetKey ("x")) {
                     rb.velocity = new Vector3 (0.0f, 0.0f, 0.0f);
                 }
     
                 jumpAllowTimer = jumpAllowTime;//can jump 0.2 sec after
             
             } else {//not grounded
                 jumpAllowTimer -= Time.deltaTime;
             }
     
             if(jumpAllowTimer >= 0)//just to make it a bit more forgiving
             {
                 if (Input.GetButtonDown ("Jump")) {
                     rb.AddForce (0.0f, jump, 0.0f);
                 }
             }
             Debug.Log (jumpAllowTimer);





Comment
Add comment · Show 9
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 nu-assets · Jun 22, 2015 at 05:58 AM 0
Share

To debug weird behaviour try making a version as simple as possible:

 bool jumpAllowed = Physics.Raycast(playerT.position, -Vector3.up, 0.6f);
 
 if (Input.GetButtonDown("Jump") && jumpAllowed) 
 {
     Debug.Log("JU$$anonymous$$PED");
     rb.AddForce (0.0f, jump, 0.0f);
 }

Try that and check if the log message shows up in the console every time you hit the jump button.

PS: check your timed jump lock jumping gets allowed even after some time in air. The statement jumpAllowTimer >= 0 will be true after some time.

avatar image KayelGee · Jun 22, 2015 at 11:22 AM 0
Share

Why are you using -Vector3.up ins$$anonymous$$d of Vecto3.down?

avatar image IonoI · Jun 22, 2015 at 05:09 PM 0
Share

I tried that but sometimes it doesn't jump and the message doesn't happen.

Also tried

         if (Input.GetButtonDown("Jump")) 
         {
             count++;
             Debug.Log("JU$$anonymous$$PED" + count);
         }


Looks like some updates the jump button doesn't trigger. It didn't update the message every time.

avatar image nu-assets · Jun 23, 2015 at 05:22 AM 1
Share

Are you sure that your keyboard is ok? $$anonymous$$aybe your spacebar is damaged. Try another key or give a try with another keyboard. Your code should really work...

avatar image ColouredCarnival · Jan 10, 2017 at 08:32 PM 0
Share

I have the same issue with my code :( I'm also using jumpAllowTime (got that from Youtube, Eteeski tutorials but the videos were deleted)

Show more comments

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

9 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Jump Further When Key Is Held Down 1 Answer

When I Hold The Jump Button, Player Will Fly? 2 Answers

Help with player script. 1 Answer

My player is able to double jump, any way to make it a single jump? (C#) 0 Answers

How do I set up my players controller script (How do I change the controls used to move and look) 2 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