And I’m trying to fix them up here. Unfortunately the only advice I’ve found on the matter has been to either create an array of invalid walls or add a counter with a max number of wallrides. I’ll probably end up implementing the former at some point but I was hoping for a more generalized logic without a hard limit on the number of wallruns..
Let’s start with the first issue: Wallrunning on the same wall.
I thought this would be easy to fix, just keep track of what wall you’re on by saving it as a variable. Then when you wallrun on a new wall, compare to the old variable and if they match - No wallrunning for you!
Buuut I’m doing something wrong here because the two variable seem to always be different. I imagine I’m missing something obvious:
As for the second case, the corner climbing, I’ve no idea how to approach. I thought about maybe comparing Player Direction vectors and seeing if they intersect or something but then that’d also stop us from using the corner in the “Correct” fashion too I assume. Is this even possible to fix? Any advice would be appreciated.
Well, I figured out one of my issues. I didn’t have a check to see if my Last Wall was valid or not, adding that seemed to fix the “Hit Actors always matching” issue, but now once you run on a wall, you can’t run on it again, even after landing. So I gotta figure out a workaround UE being unable to reset hit actors to null. Maybe I can try and render it invalid somehow or make a second variable to track this.
So I keep track of the “Current Wall” and when I stop wallrunning it sets a “Last Wall” variable. The != node compares the Hit Actors of the Last Wall and the Current Wall. I created an IsValidHit macro just to verify the Hit Results are not null. Then I have a “Has Landed” boolean that starts true and gets reset to false on a valid wallrun, so we are able to wallrun if the Current Wall is different from the Last Wall OR we have landed at some point between the walls.
Now, there was also a weird Race Condition that would rapidly toggle the Branch, resetting it to true before actually touching the wall again, but instead of figuring that out just added a delay before resetting the Last Wall to NULL which I do by setting it to an unset variable. The side effect is that if I hang onto a wall for longer than a second it’ll wallrun again, but I can accept this.
Still no idea how to address the corner hopping. I might just end up designing levels around this exploit to minimize its impact. No corners without ceilings above them or something. That’ll be rough if I ever want to make a cityscape.