Character's weapon collision with walls

Hey everyone. I’m quite an UE4 newbie and recently ran into this collision-related problem.

I’m doing a shooter game and here pictured is a character holding a weapon (as an actor attached to a socket of the character’s mesh - all weapon actors are subclasses of a single Weapon blueprint), but I’m having a hard time figuring out how to make the weapon collide with the walls so that it doesn’t allow to shoot through walls :smiley:

What I already know:

  1. you can’t really alter the character’s capsule (inherited from Character) other than its height and radius, and the capsule is the only thing that the standard CharacterMovement class cares about;

  2. adding another capsule embracing the weapon to my character class doesn’t work (as a consequence of 1.);

  3. I’ve also tried setting the collision properties on the weapon mesh itself, also no effect

  4. If I set the weapon mesh to OverlapAllDynamic, overlap events work as expected, but I don’t think I want to dodge the issue by doing an animation pointing the gun upwards when approaching a wall (as many answers suggest).

The wall’s mesh collision preset is currently set to BlockAllDynamic.

If someone takes his time to help me, I owe him a beer :slight_smile:

http://i.imgur./7AZoQOc.jpg

I think a blocking volume could work?

The blocking volume is not something I can add to an actor and from what I’ve tried, when placed on a level, the CharacterMovement module of my character still uses only the character’s capsule to determine if there’s a collision or not.

Speaking of 3 - I meant the actual mesh of the weapon, I had no additional collision object such as a capsule or box (but I’ve just tested it with a capsule added on top of the weapon, with no effect).

As for 4, I’ve tried enabling it in all of the involved objects with no effect.

Regarding 3: Are you sure you have a collision mesh on your object?

Regarding 4: Do you have “Simulation generates Hit Events” enabled in your collision properties the very first checkbox?

I meant the actual mesh of the weapon

Collision isn’t done by the actual model. Technology isn’t even close to that. Having physics check every poly of every model? That’s insanity. You can’t do that for multiple characters with several tens of thousands of polys.

If you open your mesh you have a tab collision and a button with the same name. Press the button to see the outline for your collision. If there is none then your mesh doesn’t have a collision right now.

Then I don’t really know what’s wrong.

Maybe the animation / movement from the character overrides the collision? But then it should still generate hit events…

By saying “the actual mesh” I of coursemeant the collision bounds that are stored with the mesh asset - like in the picture below. This itself I think works properly because when I set the mesh’s collision preset in the blueprint to OverlapAllDynamic, overlap events are generated properly.

http://i.imgur./G8nrBrV.png

I pointed that out in 1) - what I understand from the explanations I’ve found, is that the CharacterMovement component of UE4’s Character class only cares about the ‘root’ capsule of the character.