x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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 :-D

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 :)alt text

Product Version: UE 4.9
Tags:
more ▼

asked Jan 07 '16 at 12:53 PM in Blueprint Scripting

avatar image

vanbush
16 3 4 4

avatar image Erasio Jan 07 '16 at 04:10 PM

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?

avatar image vanbush Jan 07 '16 at 04:20 PM

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.

avatar image Erasio Jan 07 '16 at 04:45 PM

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.

avatar image vanbush Jan 07 '16 at 04:53 PM

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.

alt text

avatar image Erasio Jan 07 '16 at 04:55 PM

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...

avatar image vanbush Jan 07 '16 at 04:58 PM

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.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

I think a blocking volume could work?

more ▼

answered Jan 07 '16 at 01:21 PM

avatar image

EyeDee10Tee
2.1k 59 14 126

avatar image vanbush Jan 07 '16 at 04:06 PM

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.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question