Shooting using Line Trace in C++

Hello.
I’m trying to recreate this:

in C++.

If there’s something wrong with this picture don’t correct me. I didn’t use Blueprints in loong time.
Basically I want Line Trace after pressing LMB (I already created input and declared function) and spawn a projectile from class “RedPlasmaProjectile” in the impact location.

Please help if you know the answer.
Thanks!

You need to add the multiplied Forward Vector to your Actor location, Start and End location of the trace are absolute world locations, the End location is not relative to the Start location.
You can use the Draw Debug functionality of the Function to see where the Line Trace goes this helps a lot to find mistakes.

Take a look at this question

Ok, but what are the functions? How do I actually execute the line trace in C++?

watch this. How To Do Line Tracing Using C++ In Unreal Engine - YouTube