❔ unity single jump
Hi, I need some help about jump mechanics in unity, I have written a code that suppose to make the player do a single jump but he double jump instead. If does someone and idea why, I will appreciate him.
10 Replies
might the Update be executed => force is added => OnCollisionStay is executed => isGrounded = set to true
then the next frame loads?
in the next frame, the player moves but isGrounded is true?
@Tvde1
first OnCollision be executed => Update then isGrounded = false => isGrounded is true "when I'm not touching anything" => Update is executed while I'm in the air
is that always the way it is?
probably
did you measure it or is that an assumption?
because bugs are caused only by bad assumptions
sorry I am new in game development, can you give me a simple code.
are you using threads? maybe try to put isGrounded = false before the addForce call
you might be reentering the update function before isGrounded = false
It's not.
There's also $unity
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.