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.
You can use components from begin overlap or hit events:
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:
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.
answered Sep 24 '18 at 11:44 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here