[2D] gravity independant jumping

Sup! I have the following code:

void Update() {
    if(Input.GetKey(Keycode.W))
    {
       OnJump();
    }
}
void OnJump() {
	rigidbody2D.AddForce(new Vector2(0f, 300f));

}

It works fine until i double jump, i mean, when i press W, and then when i want to jump second time while object is falling, i don’t actually jump that high as if i would jump first time. It’s logical because force works against the gravity. yet i have no idea how to make jumping without adding force. Do you have any ideas? :frowning:

ah,

		rigidbody2D.velocity = new Vector2(rigidbody2D.velocity.x, 0);

did the trick.