In this example, we get a linetrace with the forward vector of our object.
We change the trace channel of our target and also our line trace so that it works only on objects with the trace channel we need, while ignoring other channels.
To add a new channel you need to be in a project setting.
On the left panel, find in the section engine, collision.
Create a new trace channel. Add the name of the person you want. Accept the changes and it will be added to the list.
Open our blueprint or select the mesh we need. In the collision section, change the collision preset. And then adjust our created collision according to our preference.
Now in our function line trace by channel. We can select the channel we need so that our linetrace reacts only to objects with the same channel.