Targeting [NEED HELP]

Hello great community.

I need a tutorial ( was looking, couldn’t find ) or suggestions/ help with aiming/ targetting.

I’m making a TPS, and I have abilities for my players. Basicly what I need is, that some of abilities are no lock( so shoots where aim) and some I guess it’s called soft lock. Basicly that it shots fire ball or some kind of laser what drains health only when target is in front of my croshair. When it rans out, I can’t throw fire ball any more or that draining laser stops to drain enemy helth.
I hope I explained well.
Thank you.

As Example What I mean, can give Torvald from Paladins. His Ability Nullify works only when aiming at target. And Gauntlet just works as no lock.

I know I should use Raytracing. But how can I make it:

  1. To get other player info (Health, name etc.)
  2. And lock target only during spell…

If I’m reading this right, you need to use a single channel line trace. Get the Forward vector of the camera (which is the way it is facing) and break out the hit object. If the target is in front of the ray trace (you can cast to opponent type to check this), you can use this info to reduce the target’s health. This is how you would check a hit for a gun shot.

If you have a constant beam, then you need to check the line trace, every Tick, while your ability button is pressed down or until you run out of fireball ability (mana?).