How would I prevent my character from going into a wall while prone?

Hello,

As the title says, I have a problem with my existing prone system. Basically, while my character is prone, the character mesh can go through a wall. I know and expected this to happen because of how Unreal’s collision management works with characters (since it only goes by the collision capsule unless you want a complete mess), but I was wondering if anyone had any ideas for how to prevent the character from doing so, while simultaneously treating this collision as the capsule would (i.e. if you’re up against the wall, but moving diagonally, it will slide slowly against the wall).

I have a couple of ideas prototyped in Blueprints, one of those being to allow the developer using my framework to add box components around the mesh with a “-checkprone” tag, and to stop up movement input completely should one of those boxes hit, but A) that’s not the most elegant solution for what is to be a very AAA-level framework, and B) camera rotation becomes very frustrating to deal with if the pawn is also supposed to rotate with the camera (although this issue could probably easily be dealt with just by switching some booleans).

If you have any ideas I will happily take them into consideration. Feel free to send Blueprints as well and I will do my best to translate them to C++ (which is what I have been doing so far).

All help is appreciated, and thanks in advance!


Note in the image above: I do have the collision sizing working for the capsule, so when I use the prone function it does indeed shrink as needed. This is just an example with a fixed prone animation because with that function it does the same thing.

1 Like

Hi there,

You can use sphere traces/ capsule traces to block movement input in certain directions, and also to check if a given area is suitable to enter the prone state.
Perhaps this video can help you out.

1 Like

You can spawn an additional collision shape with the same collision setup as the capsule. The additional shape should lie flat on the ground and grow up to the size that is the character + legs, arms etc.

Might work with players but testing on my AI, the additional collision capsule does nothing when they back into obstacles.