Hi guys, So im creating a melee attack system for my game, I’ve seen a lot of variations to make an attack system, but I dont know what would be the best for my case.
I’m making a game where the main character is a dog, this dog should attack with his arms, just like a punch.
What would be the best strategy for this?
Well like you say, there are many ways to go about doing it, you could create a collider in front of the dog and use that to detect if an enemy is in Range, or you could use raycasting to project out from the player a short distance, and if it hits an enemy, that enemy has been hit (I believe that’s how most games do it) There’s also the method of having a collider on the characters Fist (or Paw in this case) that would physically detect if you’ve connected with the enemy (Assuming you’re working in 3D)
Obviously, these have varying degrees of accuracy and realism, but personally, I would go with using raycasting from the players head, (Checking if they’re looking at an enemy when they punch), though it doesn’t matter as much if you’re working in 2D.