Line Trace Help

I need help with a line trace that I’m using for picking up/gathering/attacking things in my game.

My character scans for items that contain the appropriate interface (attacking in this case) and detects them by running into the actor’s “interact zone” (a collision sphere). The problem is that my line trace is also using this collision sphere, and as a result, my character can aim anywhere inside the interact zone and have the attack function still call.

I want it so that the attack function calls ONLY if the player clicks on the mesh, not the collision sphere. How can I do this?

Yes, this is extremely easy to do. Every mesh and collision shape has collision settings on it that you need to adjust.

Click on a mesh or collision shape → details panel → Collision.

Here you will find the object type, and its response to trace channels. You can set a mesh or collision shape to ignore, overlap, or block channels. You will also notice when you do a line trace, the node has an option for which channel or object you want the line trace to run on.

In the image below I have a capsule component selected, and you can see in the details panel it is considered a “Pawn” object type, and it will ignore the visibility channel. The line trace in the graph is set to run on the visibility channel, so this line trace would never interact with the capsule or any other object in the world that has its visibility response set to ignore.

You can create your own object types and trace channels in project settings → collision. (If you need / want).