Download

Can click-select everything ... except pawns

… and pawns are the only thing I need to select.

Turn based tactical kind of thing. XCOM like.

I’ve spawned my pawns into the level, but I can’t click on them. I can click and focus on literally every other actor in the level, just not the pawns.

I’ve tried:
GetHitResultUnderCursorbyChannel ← doesn’t recognize my pawns
LineTracebyChannel ← doesn’t recognize my pawns

Both of these will go through the pawn and show that I’ve selected the landscape under them or the wall behind them. The LineTrace, when debug is turned on, goes off in a random direction, which makes no sense. My start trace is the camera world location and end trace is the camera’s forward vector multiplied by a float for distance.

Get Hit Result Under Cursor by Channel & Line Trace by Channel mean very little on their own. It’s about what channel is being used.

GetHitResultUnderCursorbyChannel relies on the Visibility channel (by default) and can be adjusted in the Player Controller. Same with the LineTracebyChannel - but you get the choose which channel on the node directly.

The Pawns (whatever they use as colliders) must block that very channel (True by default).

My start trace is the camera world location and end trace is the camera’s forward vector multiplied by a float for distance.

Sounds like you forgot to add the actual world location to the end of trace.

They were both set to Visibility. (The controller and the GetHitResult) I tried to change them to Pawn, but only the controller has this option. The GetHitResult only has Visibility and Camera options.

But either way, if they are both set to Visibility it should work, but it isn’t

No, but it’s not random. I’m thinking it needs to go where the mouse clicks. It’s not. It’s going to go where the camera is pointing. Even so take a look at this:

On the left, I’m am printing what is being hit. Here you can see the lines going through the pawn, but on the left it says “landscape.”

Ultimately, the line trace won’t work for me. I need the cursor location, but the line trace gives me the debug line. I expect if I get one to work the other will too.

Manually tracing to cursor location from the camera looks like so:

As you can see here:

Visibility is ignored for the Pawn preset, this has to block to match the Trace Channel.

Player Controller + Get Hit Under Cursor uses the same.

You can also add more channels, ofc:

Ultimately, they’re just names, they do not really do anything. Think of these as granular filters.

1 Like

That was it. Visibility was set to ignore.

Thanks.

1 Like

If you ever get into a pickle with those, may I recommend this:

It’s a nice writeup.

1 Like

I appreciate that link. It’s so hard to find good documentation for UE. Every time I try to find something in the Unreal Documentation I end up finding something like this:

which is so completely useless, I can’t help but wonder why they even bothered to make the webpage.

One more question:

I’ve created a new collision channel for selecting units. I’ve set that to block in the ParentUnit_BP, but I can’t set it on the GetHitResultUnderCursor. How do I get that node to be able to use that channel?

Thanks

In the player controller:

This is also used with ActorOnClick:

image

Nope. I set the PlayerContoller default click trace channel to UnitSelect (<–my channel). The ParentUnit is set to block that channel, but still the only two options I get on the GetHitResultUnderCursor are Visibility and Camera. I need to get this node to use that channel.

PlayerController:

Screenshot (52)

Screenshot (53)

Not sure what is Nope about it:

  • new channel in the controller for OnClick:

image

or for GetHit:

image

  • blocked by the pawn:

It can also be used in Line Trace.

Refresh the node?

1 Like

Refreshing did the trick.

Much appreciation.

1 Like