Melee Combat

I want to start a game that focuses on melee, martial arts combat, but I don’t know what the best way of doing it is. Should I use a contact method where I attack a collider to the hands and feet and when they collide with the enemy, while attacking it causes damage(Im not really sure if that would even work) or do something where if the opponent is in front of the character he gets hit when you push a button (which sounds like it may be hard to sync the hit with the animation). What way (one of the above or any others you may have used in the past) would be effective and make it look decent. I want it to look at least somewhat realistic, but it doesnt have to be some professional level game quality.

I did something like what you said last night where I just do a on trigger enter to see if it hit the enemy collider.

You could make the collider even larger then the actual hands and legs and just check the distance the player is from the enemy

Yea for my melee system I attach a box collider to each weapon then us OnTriggerEnter() to send a message to the damage function of the object collided with.

At first when I’d just walk up to a monster it would do damage if it touched them so I made a bool isSwinging = false at the beginning, then in the player input, at whatever function you use to getkeydown(“key”) it sets the isSwinging = true, and when you release the key, getKeyUp(“key”) sets isSwinging = false again. So while you hold the button down it enables the collider on the weapon and the animation moves it.

Since you’re not using weapons, you’d probably put a gameobject in each fist and on your knees or feet, depending if you have kick or knee animations, then add sphere colliders checked as trigger, to each gameobject.

Thanks guys. That really helped a lot!