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"

How do you check for a specific collision box on collision?

I'm working on a 3D platformer and want to have the player punch and jump on enemies. I want it so that when a enemies collision box is overlapped by the player it can check which collision box hit it, The regular player collision box or their foot collision box, so I can have them damage the player or be damaged respectively.

I know I could check if the player is hitting an enemy from the player blueprint when that collides, but as far as I'm aware that means I'd have to check if the object colliding with the foot or hand was each individual enemy type, and that seems inefficient.

Product Version: UE 4.20
Tags:
more ▼

asked Sep 24 '18 at 11:36 PM in Blueprint Scripting

avatar image

Skyace65
7 1 1 5

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

You can use components from begin overlap or hit events: alt text

On overlap (or hit event) you can check if the component you've collided with has a certain tag (in my example that's weapon) and then you can branch from there and see if you need to deal damage based on that tag.

You can set up component tags of your enemies or other blueprints in the detail editor: alt text

For example: Your character is a pawn or character class, and your enemies are pawns called enemy. Those enemies have collision boxes attached to their hands, which have "weapon" tag added to them. In your character class you set up this scenario I've mentioned above and it should work.

capture.png (52.1 kB)
capture1.png (23.2 kB)
more ▼

answered Sep 24 '18 at 11:44 PM

avatar image

Dovlahkin
78 2 4 9

avatar image Skyace65 Sep 25 '18 at 03:30 AM

Thank you!

(comments are locked)
10|2000 characters needed characters left
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