Does anyone know of a way to do "coyote time" and Jump buffering ?

My guess for trying to implement Coyote time (a system that allows the player to jump a few frames/fractions of a second after they leave a platform) is something like check every frame to see if the player is on a platform. The frame that I see they are no longer on the platform I would record the game time to a variable, called “timeLeftPlatform”. Then if they tried to jump, I would see if the game time was within 0.5 seconds of “timeLeftPlatform”. I already have a jump working,
The thing im struggling on is how to record if the player is on, and then no longer on a platform, and then record when the player goes off the platform and use that to compare against the time limit in which i allow the play to jump within?

Or is there another way entirely that is better?/ actually works?

As for jump buffering, i have no idea how that would work

I would do this: have a single float variable that is your “mayJump” value.

Every frame that you are ON a platform, just set this value to (for instance) 0.5f.

Every frame subtract Time.deltaTime from this value:

mayJump -= Time.deltaTime;   // put this in Update()

Finally when you go to jump, instead of checking “am I on the ground?” instead check “Is the mayJump time greater than zero?”

When the player successfully jumps I would also just zero it out so that they can’t jump for multiple frames after a normal leaving-the-ground jump.

EDIT: Full implementation here:

proximity_buttons is presently hosted at these locations:

https://bitbucket.org/kurtdekker/proximity_buttons

5 Likes

I think i may have a way, would using onColliderExit work?

Be sure to let us know!

Yeah it worked, still needs some tweaking, if i get it working well ill post the code here for posterity

@EndyCodes @Kurt-Dekker I need some help with this. If I do the way stated above (by Kurt Dekker) the player can double jump if they spam the jump button.

Please make a new post. When you do, here is how to report problems correctly in the Unity3D forums:

http://plbm.com/?p=220

@Kurt-Dekker Sorry about that, here’s the new post with more information: Coyote Time/Ledge Assistance Causes Double Jump - Questions & Answers - Unity Discussions
Thank you!

And we never got the answer :stuck_out_tongue: looks like I’ll have to see for myself

1 Like

For those still looking here is a very good video from Youtuber bendux.

Coyote Time & Jump Buffering In Unity

2 Likes

And here is mine!

https://www.youtube.com/watch?v=1Xs5ncBgf1M

1 Like

Wow, thank you very much, your idea is so clear!