Conal AoE abilities


Author: Joseph W

Posted on 6/14/2024

Unreal has many capabilities to fetch a list of actors that are within a designated area, though specifically for fetching enemies within a cone there is no built in functionality. For mechanics that require this, such as swinging a sword to cleave enemies we were out of luck. It feels weird that there is a built-in function to draw a cone debug but not a function to use the same cone for getting objects within it.

The solution was as follows: We create a circular collider around the player and fetch all pawns within it, we then compare the direction the player is facing against the direction to the enemy using a dot product. This gets us a value of -1 to +1, which represents the angle from the player. Any value below 0 is behind the player, and any value above 0 is in front of the player. We use a value of 0.5 to get all enemies within a 45° arc from the center of the player's camera. 

Files

image_2024-06-14_152935286.png 230 kB
Jun 14, 2024

Get Proving Grounds

Leave a comment

Log in with itch.io to leave a comment.