- Home /
Making a 2D Wall Jump
Hi, I'm a noob in programming, and unity in general so I need help! I'm having problems with the 2d Character Controller in terms of Wall Jumping. My character do jump off the wall, but it does with a low force jump and only going horizontally. Someone has any clue of what happens?
Answer by GamePaint · Aug 10, 2018 at 11:49 PM
The horizontal jump indicates that inWall is false:
if (inWall && Input.GetButtonDown("Jump"))
{
WallJump();
}
else
{
//This seems to be the horizontal jump, indicating that inWall is false
rb.velocity = new Vector2(rb.velocity.x, 0f);
}
If inWall is false, the problem is probably in OverlapCircle:
void CheckIfWallJump()
{
inWall = false;
inWall = Physics2D.OverlapCircle(WallCheck.position, inWallRadius, WhatIsWall); //--
}
Are you sure that the circle is overlapping with the wall? Is WallCheck.position in the middle of the player's collider? Is inWallRadius so small that it is on the inside of the player's collider? If so I guess the WallCheck does not hit the wall on either side. If so, you could try positioning the WallCheck in front of the player so that the OverlapCircle touches the wall before the player does.
Hi! Thanks for answering, I saw the error there in the "else", and I just fixed it, but It doesnt seem to work! I did this thing:
if (inWall)
{
rb.velocity = new Vector2(rb.velocity.x, 0f);
if (inWall && Input.GetButtonDown("Jump")) //--
{
WallJump();
}
}
So whenever is touching the wall, the player stops and there and can jump! But the problem is still not fixed, the player just jumps in the x axis and doesnt go up! The problem isnt in the OverlapCircle, as it works perfectly. I'll keep searching
Your answer
Follow this Question
Related Questions
Collision returning an error 0 Answers
UI Image problem, not set to an instance of object 2 Answers