Help with wall jumping

Does anyone have any idea on why my wall jump setup isn’t working properly?

Basically I’m trying to make a wall slide/wall jump setup that works like how it does in the various Mario games:

super-mario-bros-wonder-wall-jump

My player character should be able to leap from one wall to another like this:

Instead my player character will usually do one proper wall jump from one wall to another and then begin ascending up the wall in a Mega Man X-style on subsequent jumps, which isn’t what I want.

Wall Check:

Wall Jump:

Hey,

you’re using the actors forward vector for a wall jump.

Instead you should be using the wall hit result (from the line trace) and grab the impact normal as the direction for the launch force.

This way the player should always get launched away form the wall, unlike your current example where the actor gets launched in the direction he is facing.

1 Like

That’s not quite true, the wall jump force is set at a negative value so that the character will jump in the opposite direction of where they’re facing.

It just doesn’t work in a consistent manner with the character typically only jumping away from the wall on their first jump & not the subsequent ones.

If its not too much to ask but could you elaborate on this? A lot of this stuff is outside of my current comfort zone of knowledge and none of the wall jumping tutorials I’ve found so far address this subject.

I see, didn’t know that. Either way you shouldn’t do it using the forward vector but the wall normal to get consistent results.

This would be a silly example on how you could do it:

Since I am using the impact normal, the jump will aways be orthogonal from the being wall jumped off.
Therefor you would have to add an elevation value onto the Z component so the character will also get launched upwards and not just away from the wall.

You might as well also want to set the Z component of the ImpactNormal to 0, to have a consistent upwards boost, as walls that aren’t steep will have a high Z component and therefor launch your character upwards already.

Optionally, you may also want to draw a debug line to see what the final jump force looks like in 3D space for spotting errors in your calculation.

1 Like

Okay, so I combined your solution with my current setup and I managed get the wall jump working.

Wall Slide:

Wall Jump:

However, there’s still an issue where if the player character wall jumps while facing left, the character will not turnaround, resulting in them jumping off the wall while facing the wrong direction. This in turn results in the character not being able to rebound off the wall due to not facing the wall when they come into contact with it.

This problem can be circumvented through manually turning the character around with the controller but I still need to fix the underlining problem.

Any ideas on what I can do with this to fix the rotation to work properly?

Well that’s intended Behavior. The character will not rotate with forces.

I don’t know much about your current setup, but if you are not using Control Rotation, you could simply compute an X Rotator based on the Launch Velocity to set the characters rotation.

E.g.,

Another way would be to use the Controller Desired rotation and make it always facing the current velocity direction.
However, this way could have many edge cases and thus might result into more work than necessary.