Weapon going through walls

Hi there,

So recently I came up with a very simple idea that I don’t know how to implement, so I came here for some help. I am working on an FPS game and I’m trying to make my weapon not go through walls. I managed to ‘‘fix’’ this by moving my character back and not letting the weapon stick out of the collision capsule (I’m using the third person character in first-person view), but this creates another problem: the camera can go through walls sometimes, for example when looking up near a wall, because it goes out of the collision capsule.

I could ‘‘fix’’ this by setting a lower view pitch max for the follow camera but it doesn’t look good.

My idea is the following: I want to leave the character in its back position, so the weapon doesn’t stick out of the collision capsule and it never goes through walls, but make it so that when the player looks up, the character and the follow camera move forward, eliminating the possibility of the follow camera going through walls because it will always remain inside the collision capsule.

Any help is appreciated :slight_smile:

Camera Boom is used to mitigate TPP cams from clipping.
Here’s a vid that shows this: How To Stop Camera Clipping Through Walls /Objects - Unreal Engine 4 Tutorial - YouTube

You could also go the route of adding a sphere collision to the camera and dynamically adjust its position on begin/end overlap.

For weapon clipping you’ll probably want to eventually go with Inverse Kinematics.

Mushing everything into the capsule component …Scaling up the capsule component will cause other issues down the line.

Please don’t ever use any Epic service to host images.