Hi, I’m trying to implement a wall jump feature in my game where the Player is allowed to slide down slowly on the walls and can still jump whenever.
I had to reset the input axes because if I don’t, the player will stick back immediately on the wall right after the player attempts to jump while sliding because the velocity of the player depends on how long the button is pressed and it is at its maximum value when sliding on the wall so I have to reset the input axes like this:
// WALL JUMPING
if (isWallSliding && (Input.GetKeyDown(KeyCode.UpArrow) || Input.GetKeyDown(KeyCode.X))){
//Reset Velocity after Jump
Input.ResetInputAxes();
rigidbody2D.velocity = new Vector2(0, 0);
//Apply Jump Force
if (isFacingRight){
rigidbody2D.AddForce(new Vector2(-wallJumpDistance, wallJumpForce));
} else if (!isFacingRight){
rigidbody2D.AddForce(new Vector2(wallJumpDistance, wallJumpForce));
}
}
But if I use “Input.ResetInputAxes();” and the player is still holding the horizontal button, it resets the horizontal values AND acts as if the player also released the button.
Visual Representation:
As you can see here, If I press jump and I’m still holding the left button, the player will jump straight on the right wall as if I already released the left button.
What I want is this, it will push the player for a certain distance but if I’m still holding the left button, it will act as if I only bounced from the wall.

How will I reset only the values and not the button press? Any fix to that?
