For our combat, we originally we had our weapons use a collider that was toggled on and off during different portions of the animation, with the animation driving the location of the weapon (and subsequently the collider). In theory this should work nicely, however we found that in practice it did not work out as desired due to minor variances in framerate and issues with angles of attack during the animations.
This variance left the combat feeling rather inconsistent and lackluster. Our solution was a simple one, use a Static Mesh as a collider for detecting overlapping actors during the attack, fired at a logical time in the animation (we went with when the weapon was most forward). We decided to go with Static Mesh as opposed to standard colliders for the ability to use more complex shapes than the primitive colliders afforded.
We used this concept on AI and the Player Character, which immediately improved the feel of combat but brought with it a hidden flaw in our implementation that was discovered within several days before Beta release. The issue we found at this point was that the attack colliders would allow attacks through walls, objects and other undesirable illogical locations.
In order to solve this issue, the function that gets all colliding actors within the attack arc then deals damage to them had to have an additional check added. This check is a simple line of sight from the attacker to the victim before actually applying damage. Doing this simple check solved the extra problem caused by our initial decision to change the attack collider style.
author: Clinton Butler
Posted on 6/22/2023
Did you like this post? Tell us
Leave a comment
Log in with your itch.io account to leave a comment.