# Issue implementing wall jump in Unity

I'm having troubles implementing a satisfying wall jump in Unity. I managed to detect collision with a wall, but when I press the jump button, the result is alway weird or very weak. I think this have to do with the 2D physic in Unity, but I have no idead how to handle it correctly.

Here's my code with the concerned parts:

public void Move(float move, bool crouch, bool jump)
{
// If the input is moving the player right and the player is facing left...
if (move > 0 && !facingRight)
// ... flip the player.
Flip();
// Otherwise if the input is moving the player left and the player is facing right...
else if (move < 0 && facingRight)
// ... flip the player.
Flip();

if (jump)
{
if (!grounded && walled)
{
StartCoroutine(WallJumpRoutine());
}
}
}

void Flip()
{
// Switch the way the player is labelled as facing.
facingRight = !facingRight;

// Multiply the player's x local scale by -1.
Vector3 theScale = transform.localScale;
theScale.x *= -1;
transform.localScale = theScale;
}

IEnumerator WallJumpRoutine()
{
Vector2 wallJumpVector = new Vector2(jumpForce*10, 20f);

yield return null;
}


To be more precise, the result I'm getting is either my player being moved a tiny bit (despite using the same force as my regular jump, which is working fine) or my player being moved a good distance but at very high speed (this is when I'm using ForceMode2D.Impulse).

Any help?

The velocity gained from AddForce in any particular direction is affected my a multitude of factors, including the current velocity of the rigidbody.

Two things you can try:

1) Setting velocity to zero before applying the force

GetComponent<Rigidbody2D>().velocity = Vector3.zero;

GetComponent<Rigidbody2D>().velocity = wallJumpVector;