Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
12 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 /
  • Help Room /
avatar image
0
Question by FShiwani · Apr 14, 2016 at 08:37 PM · jump

Jump Actuation

I'm trying to implement a system where my code is able to detect when the player has touched the floor after jumping and now does not jump. The way I have it right now is that the player can only jump when hes on ground (I want to keep this way). Basically if the player hits the ground and doesn't time his jump key stroke properly with when the character hits the ground and isn't able to jump I want some other code to run. However if the player hits the ground and does time his jump key stroke properly and jumps as soon as hits the ground some other code should run. I want a system to be able to detect whether he has hit the ground and not jumped AND whether he has hit the ground and has jumped at the same instant. My if statements aren't working because Im using grounded as a condition which obviously is going to be true whether or not he times the jump properly.

Any help is appreciated.

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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by blakewmcleod · Mar 12 at 03:18 AM

@FShiwani,

what im gettiing is that you want the player to jump right as he hits the ground and not to late after he hits the ground.

Maybe when you use an IF statement you could set a coroutine(coding timer) to end in a short period of time and when the coroutine ends the character.ProperStrokeTime would equal false but if he jumps during that time the character.ProperStrokeTime would be true
if the character is not touching the ground the character.ProperStrokeTime would be true by default

 so 
 if(character.IsGrounded == true)
 startcoroutine("blahblahblah");

 // IEnumerator is a corotine, it does whatever than waits when you do a yield return 

 IEnumerator blahblahblah(){

 yield return new WaitForSeconds(0.4f){
 character.ProperStrokeTime = false;
 }
 void otherFunc(){
 if(character.IsGrounded == false)
 character.ProperStrokeTime = true;
 }


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

55 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

Related Questions

Jump raycast not working 0 Answers

Jump problem 1 Answer

Cant jump while sprinting (Unity FPSController) 2 Answers

Double jump. Jumping after falling off a platform 1 Answer

I'm trying to get the character to jump, is it because the trigger key hasn't been inputed correctly? 1 Answer


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