Mid-range attack
This will be a line trace from the center of our eye. This will be how you attack the AI, and this is how the AI will attack you. We will simply run a line trace and then draw a debug line over this, creating a cool red beam out of our player's forehead! We will test to see whether it works, and after this, we will integrate it into both players.
Now, to begin creating this function, we will do something different that will save us time. We will put the function in Blueprint Function Library to be shared across every Blueprint graph.
To keep the function useful for both AIController and PlayerController, we want to to give a controller as the input and then to output an actor. This function will also handle drawing the red beam where necessary:
Let's right-click, go to Blueprints and then to Blueprint Function Library. Name this
EnemyLibrary
and open it up.On the left-hand side, add new Function. Name it
LaserFromController
. Make the first input a controller namedtheController...