Collision doesn't collide with Walls/Actors (?)

I have been trying to work out a (probably very common) issue in regards to collision.

I have a Handgun Actor (BP_Handgun → Handgun.cpp/.h) which is attached to my MainCharacter Class via a socket. Within BP_Handgun, I have the collision presets set to BlockAllDynamic and seems to collide with my enemy which is a Character. However, with the BSP and Actors (cubes made to look like walls) I have in my scene, the gun doesn’t seem to collide with them at all and just clips through.

Edit: I have added some code on how Handgun.cpp (BP_Handgun) is attached to the MainCharacter.

351664-collision.png

I have tried different channels, adding in Box Colliders, etc. But no luck…

Sounds like you want Physics to magically push your pistol away? If your pistol is attached to your Character then it will force its position based on location of the socket (depends on your attachment rules). Typically you would do a linetrace from barrel forward to check if there’s an obstacle and then add relative location offset based on distance to wall without physics.
It can probably be also be done with physics but then you’ll need to apply forces to pistol to follow the character in the first place.

Bump - is anyone aware on how this could be fixed?

Not necessarily, all I am after is the character will stop at the wall where the end of the barrel is for now. I did try to add a capsule component at the end/over the weapon but it still clips.

Your character is using its own root Capsule Collider to check for collision. I don’t think it considers anything else. You can simply extend the Capsule radius to envelop the pistol actor.

That’s the sign of your colliders fighting. If you go Capsule radius path then disable all physics on pistol actor and let Character handle it.

I increased the capsule component for the character, and it still didn’t seem to work. And plus this bought in another issue of the player being thrown far when looking at the floor and moving.

Not sure I fully understand this I’m afraid. I have checked the pivot of the weapon when in game and it sits above the characters head (basically, the front of the camera). In BP_Handgun I did manually move the positioning to it looks like it’s ‘in front of the player’. Similiar to most FPSs out there.

I have updated the main post with a code snippet on how it is attached to MainCharacter. I have a feeling this might be the issue.