Download

Sticking a Character to a wall (Metal Gear Solid style)

I am currently working with the TopDown template, and I’ve adjusted (via C++) to use WASD for movement. I have a whole host of questions about that, but this isn’t the place.

For their iteration speed and general ease of use, I’ve switched to blueprints, which I will probably try to shoehorn into C++ later.

I am now trying to implement a wall sticking feature. When the player presses against a wall, the character will but his back up against the wall as long as the button is held. The player will also be able to move against the wall and (eventually) peak around corners.

Anyways, I’ve set up a custom trace channel (Stickable) and I have a working line trace. It only activates when the player presses against the wall and everything. I can’t guarantee I’m doing everything the proper way, but that works.

Right now, I am trying to get the character to rotate, so his back is to the wall. I am no good at animation, so I’m not going to worry about that at this point.

Anyway, some pictures:

7bd2a73a3e7b102dbf1853d0b3ea593c38dddff9.png

The issue I am running into at the moment is the character keeps rotating like crazy, most likely because as he rotates, the trace fails etc etc.

I am wondering the best method to get this done, and I am open to any and all other suggestions. I thought about rotating just the mesh (but then I have to worry about resetting that), or having it be completely animated. I bet some sort of state machine would work here too, but I feel like trying to recreate that functionality in blueprints is overkill, but what do I know? What is the “right” way to accomplish this.

After writing all of this out, I ought to have a switch on the button being held down. After the trace is successful, and as long as the button is held do whatever, and once the button is released, go back to normal. So, if IsSticking == true, don’t bother with the trace stuff. I will work on that, but I would love to get some hard won knowledge from you folks anyway.

BACKGROUND (skip if you don’t care):

After making a breakout prototype, I decided I needed a more meaty project to work on, so I am trying to recreate something a bit like Metal Gear Solid VR Missions. I don’t want a faithful recreation, but planned features include:

Crouching, Sticking, Prone movement. Camera should tilt for sticking, and go FP for crawling in enclosed areas.

Enemies with vision cones and MiniMap displaying this info.

I have many ideas about these things, but I thought I would include this in case anyone has any other tips for me.

In particular, I’ve seen many people run into issues using the Character & CharacterMovement classes with certain custom behavior. As far as I can tell, avoiding that would involve writing a custom class. Basically, for this sort of movement, are the built in classes well suited?

Metal Gear rotates the controller.
The obvious solution for that is while character is pressed against the wall, simply ignore any other update to the trace until player releases control…
I’ve done that in Unity years ago, don’t quite remember all little details anymore.