Creating a wall cling/wall sliding blueprint

So, I’m working on a side-scrolling platformer and I want when the character jumps and hits the wall, the cling to it for ‘X’ amount of time and then begin to slide down the wall.

I honestly have no idea how to even start this. I figured that I’d make class blueprints for the walls and then say, “when the player collides with self, cast to the player to make this happen.”

I may be going in the completely wrong direction but I needed to start somewhere. Any help is greatly appreciated!

You might want to look into the ‘Swing Ninja’ example in the marketplace.

That demo features a 2D character and has wall-jumping and pivot-swinging. Might help.

I’ve not had a good chance to screw with blueprints, but here’s how I think I’d handle it (scripting wise)

First off the variables:

  • bHang - Bool, toggles to true when a player touches a wall, toggles to false when the player leaves the wall, collides with the floor, or jumps off
  • fHangTime - Float, determines the current time the player has hung from the wall
  • fBeginSlide - Float, handles the amount of time before the player begins sliding
  • fSlideRate - Float, handles the speed at which the player will slide, for the concept below we’ll assume the player will reach their max slide speed after 1 second, Slide rate should be negative (so long as you’re sliding down)
  • vcWallNormal - Vector, store the walls outward facing if you want to add a wall jump functionality too

Now the premise:

If a player collides with the wall we want them to hang on, playing a certain animation (not sure how to handle that bit) before sliding down after a certain point.

Run a script like this every frame
To start we have, IF bHang is TRUE
This way the blueprint is only active if the bHang boolean is true (and the player is wall hanging)
Increase fHangTime by DeltaTime, time passed since previous frame (unsure as to the blueprint node to use for this)
IF fHangTime < fBeginSlide —> Set players velocity to 0, 0, 0, they’re still on the wall and haven’t begun sliding yet
ELSE —> Create a float for velocity equal to X, where X is fSlideRate * (fHangTime - fBeginSlide) OR fSlideRate, whichever is closest to 0 (remember negatives, also prevents players reaching insane slide speeds).
If all your walls are direct down then set player velocity to 0, 0, X, if not then some maths using wall normals will likely be required.

EXTRA: If the player hits Jump, apply force equal to ((vcWallNormal + (0,0,1)) / 2) * JumpForce and change bHang and fHangTime to FALSE and 0

Sorry if this makes no sense, I’m not fantastic at explaining things, this is the sort of proccess I’d use to handle it, simple, but it kinda works, does this help in any way, if not message me and I’ll make a flowchart or something to hopefully explain what I mean a bit better.

I know how to set it up in theory, I just don’t know how that translates to blueprints. I’m not sure how to get it so that the player stops dead and then after ‘x’ amount of time applies a gradual force to slide down.

That was the premise of my question I guess, how does this specifically apply to blueprints as I know how I would do it in, lets say, Kismet but not blueprints.