Modify character movement mode to walk on walls

Hey,

I read quite a bit about implementing a new movement mode in C++ but I’d prefer to stick to blueprint.
My goal is something really similar to the default walking movement mode but it has to allow movement beyond 90 degree. I scripted my own little gravity for the character if one can call it like that so I really just have to get rid of this limitation.

The other defaults are no real help either. Falling obviously doesn’t help at all, swimming neither. Flying actually comes really close. The movement works exactly as intended with two little issues. Rotating moves the character slightly forward as well (so very fast left and right rotations make you walk forward) and there is this weird type of gliding which is not exactly ideal.

I would appreciate any ideas in how to either get rid of one of the negative points from one of those movement types or if absolutely necessary to create a new one and if it’s C++ only it’d still be great to know that so I can move forward there.

The basic problem I have is: I want to be able to move at walls and switch which walls I’m walking at, including the ceiling and walls which are not exactly facing in one of the 4 traditional directions. As I wrote so far I wrote my own little gravity type of thing, the rotation is interpolating during transitions between the two directions and all that good stuff. The only actual issue is that it only works for the lower 180 degree (90 - 0 - (-90)). I can’t get beyond that with the basic walking movement and flying comes with functionality I do not wish to have.

Thanks and cheers :slight_smile:

EDIT: Alright so first up I noticed that BP will get me nowhere. Alright fair enough let’s take a look at the C++ code the CharacterMovementComponent.cpp to be exact (and the header to update the walking angle). Changed the trace which checks for a floor to not look down but downwards in relation to the character, overwrote the limit of 90 degree in the character blueprint, set flying active (just in case so those few checks return true and don’t set me to falling when there is a “barrier” nearby and I also as a test passed on the Z velocity during the walking movement simulation. At first I thought it didn’t load any differences until I changed the angle to accept input up to 180 degree…

No difference… well a slight difference. I do not hit a “invisible wall” anymore at 90 degree but just change my mode to falling which will not revert unless the ground below my character has a very small normal (basically it has to be pretty much horizontal). I will now try to use the flying mode and code the movement myself since my own skills of modifying the source seem not good enough to achieve this modification…

My team just thought to walk on walls by extending/altering character movement exactly as you’ve attempted to.

So you are saying that, given changing the hard coded assumptions about Z-Down to Relative-Down, the behavior is actually the same?

Well I’m not great in C++. You should always keep that in mind. I think I understood most of the code but I’m used to luxurious languages like python.

Anyway all I did was inside of the charactermovmentcomponent. It does several checks all directly downwards (they use a new FVector(0,0, -TraceDist) while TraceDist is a calculated height from the character capsule and a few other values) and just add that to the current component location (UpdatedComponentLocation or something like that).

I tried to directly overwrite those at 4 locations it was I think? In “FindFloor”, “ComputeFloorDistance”, “Simulate Movement” and something with crouch which I didn’t actually overwrite because I don’t crouch. From what I gathered the Floor plays a fairly important role while walking and most checks are done with the most recent hit result onto that floor. If this is invalid you are sent falling.

I do think I just failed to find something fairly easy because no matter what I couldn’t find a location where it properly checked for the normal and then set your movement mode to falling. By simply removing that it should work. I highly assume it’s just a check I didn’t find due to my fairly weak c++ skills.

Now at my university a few guys I know modified it in a way that it simply passes down the full vector for gravity which allows them to change the orientation of the gravity in the level which apparently wasn’t too hard.

If you just want a wallrun it won’t be necessary at all either. The only reason I’m looking for it is because I want to create a maze which at the first glimpse and during the first few minutes of gameplay looks perfectly ordinary but then adds the walls and just straight up changes of direction to it just to screw with peoples heads ;D.

In case you figure it out or want to talk feel free to hit me up on the forums (via PM) or via skype (my account is linked on the forums, same username). I will post a solution here once/if I have one :wink:

Thanks and good luck!

Looks like this thread is getting a little old but I thought I would go ahead and post anyway. I was hoping to achieve a similar function with walking on walls but something that can be activated or triggered by the player rather a constant. So for example the gravity would remain normal unless the player were to hit the key that would activate the walk on walls function. If someone were to explain the best way to approach this it would be greatly appreciated.

Regards