Jump 2D error

Hi, i am making a 2D game, like “Super Mario”, a platform game.

I have a terrain composed by differt parts, that are placed side by side (each part has its own edge collider 2D).

The character jumps if i press the UP arrow. Sometimes the character does a very big jump. This happens when the character jumps very near an object…

What can i do to solve this problem ?

Here you can download the demo of the game for testing and see what is the problem :slight_smile:

https://www.dropbox.com/sh/x8ff4ajzg70h2k2/AAA03gDiLqd7ZXNBrnLt2L87a

Thank you so much :slight_smile:

The problem is, as I could saw if you jump next to an object you jump into the sky.
I think this is because the addforce activates even if you are jumping.

I’d try to add a criteria.

Try this:

if(rigidbody2D.velocity.y == 0){
rigidbody2D.AddForce(new Vector2(0f, jumpForce));
}