I want a system similar to that of Valorant’s where you can throw a fireball that blinds the enemies looking near it for a few seconds. Is there a way to do this and check if the player is looking near something with a certain tag or certain actor? I know of a method involving a dot product, however you need to know exactly the actor you are looking for for this to work. I just want to have something like a fat raycast that tells me all the actors the player can see, and then cast them to the actor I want to see if the player should be blinded or not. If there is a better way to do this too, I would like to know. I feel that these methods will be too taxing on the computer.
“however you need to know exactly the actor you are looking for for this to work.”
This is the case for all communication between classes/blueprints. You will always need a reference from one to the other, or vice versa, or both. However there are countless ways to do this. Epic has a great video on that topic:
The simplest way off the top of my head is probably to do a multi sphere or multi box trace from the explosion. Using a custom trace channel for characters, you can then get a reference to all the player characters within a certain radius and then maybe use a blueprint interface to send out a message to those characters.
Then, the characters who are implementing that blueprint interface, and are hit, can implement their own functions/events triggered by that interface message. This is probably where you would check to see if the explosion is on screen.
As for whether or not it is on screen, that’s actually relatively simple. There’s a node called “ConvertWorldLocationToScreenLocation” that does exactly what you need. You just feed it a player controller and a location and it gives you X,Y screen coordinates.
Oh man @PixelOmen, I never thought of it that way! Anyway, this does answer my question, so I give my thanks :)))