How to add hitboxes for fighting game?

Hmm so this is what I was thinking:

First, I have to setup different types of hitboxes on the character, then program them so that if the opponent’s attack collides with a certain hitbox, X happens.

Second, I’d add collisions that are tied to different sockets/bones of the character so that when the character attacks, those collisions are enabled and then disabled after the attack is finished. This is used for activating the collision check on the enemy’s hitboxes when these socket collisions come in contact with the enemy’s hitboxes during an attack.

I’ve already started on the second step, but I’m unsure of how to add hitboxes to the character. Like I know how to add collisions, but I don’t know how to add them depending on what state the character is in, i.e. Idle, Attacking, Blocking, Crouching, Jumping, etc. I think I have to add the collisions into the actual animations of the character but I have no idea how to do that. All I know is how to when he is in his default state. I know how to do it in theory but I don’t specifically know how to add hitboxes to certain areas of the character depending on what he is currently doing, in UE4. I assume I’d be using a state machine. I’ve got one setup but that’s only for my punching and kicking animations.
…am I making sense? I’m not an expert on fighting games, so it is hard for me to think of how they work in terms of programming.

I’ve looked at this question, and I’m trying to follow ScottSpadea’s advice, but I don’t know how: 2.5D fighting game - Programming & Scripting - Epic Developer Community Forums

This is what I’ve done so far for the second step:

Please help :slight_smile:

Couldn’t you just add the collision boxes in the standard state in your character BP and parent them to the particular body parts via sockets? Then no matter what anim state your character is in, the collision boxes follow that body part?

That’s one way to do it, but I think the best way is to use box collisions and make them act as hitboxes for the character. I figured out how to do it and I’m still working on it.

Thank you for the suggestion, though

UE4 don’t have fighting game collision system as it’s a engine primary made for shooter-like games so collision system is made for it. You most likely need to do your own set up using box component and try to animate them somehow, check overlaps or do box tracing on right moments, maybe do some components with specific box shapes. Would be best if you do such system in C++ as you will need to do per frame operations (or maybe try nativitatem)