How can I get my actor to block a channel trace?

I need help figuring out the best way to detect if the user’s right click was on a Building or the Landscape (and later down the road, a Soldier).

I already implemented the ability to move the unit to the location on the landscape where the player right clicks. Now I’m having trouble refining that so they only move to the location if the right click wasn’t on a building actor.

My landscape has a channel of “Landscape” that is set to “block” in the project collision settings. My building actor (which is just a shape mesh) is set to “ignore” the landscape channel.

I thought calling GetHitResultUnderCursorByChannel and looking for the Landscape channel would achieve this, but even though my right click happens on top of my building actor the landscape hit result succeeds.

The simple hit result call is below.

Here’s a picture showing “true” is returned from the GetHitResultUnderCursorByChannel(Landscape) function even though I right clicked on the actor. My expectation is the actor would have blocked the trace from reaching the landscape.

Well, if you think about it. The trace channel response for any object can only be ignore, overlap and block. If the trace is blocked, you will get a positive response. So you cannot exclude actors by overlapping with this. because the building will either block landscape or ignore it. If it blocks, it would mean the building is landsacpe and if it ignores, the trace will hit the landscape anyway.
If you have a few trace channels you could go and check for Building and if it is not a blocking hit, check for soldier and so on. And if it is nothing of all, it must be landscape. Or you do an ordinary line trace and just check what kind of objects you where hitting. Either by comparing tags or objects types or whatever.

or use LineTraceByObject and only check for specific object types

You clicked on the actor hoping for a landscape trace. The actor is set to ignore the trace, so it is not detected. The trace continues on to the next entity, which is the actual landscape. And then the trace detects the landscape.

If you set the actor to landscape > overlap, the trace will detect the actor and continue on to detect the actual landscape. Set it to landscape > block and the trace will detect the actor and will end at the actor. Block is probably what you want.