Cannot get character using Hit Result Under Cursor

Hi, I’ve been trying to add a fire option, when the user right clicks on the enemy pawn. I’ve tried using ‘Get Hit Result Under Cursor by Channel’ and then break the hit result to check if it’s a pawn. But it’s unable to recognize any of the characters under the hit result. It can however recognize all the static meshes perfectly. I have used ‘Block Visibility’ under the collision settings of my character’s capsule component. Still it’s not detecting the character. However it can detect the floating widget scene component that I use above the character for displaying it’s HP. Is there any restriction to this node when it comes to detecting character root capsule component?

This should work for the pawn root.
Can you post a screenshot of the capsule collision settings and of the call to GetHitResultUnderCursorByChannel?

Sure, I’ve attached the screenshot for the same.

And here are a couple of shots showing the print error:

Oh and in the above cases, I’ve been using a character blueprint, not a pawn blueprint. I’ve edited the question accordingly.

I’ve tried this out with a new ‘Character’ Blueprint with the collision set to block all. Still the Hit Result doesn’t register the actor and goes directly for the floor mesh. I’ve tried the same with a pawn with a root capsule and it works.

I’ve tried this in a new Top Down template game, and I’m getting the same results. If I add an extra box component to the character, it’s being detected. But the default root capsule component fails to get registered on it’s own. Is there any workaround to this?

Hi Stormrage256,

I’m trying to get a repro of this issue. Which version of the editor are you testing this in?

Hi, I’m using version 4.6.1. I was able to reproduce it using the Top Down Template.

Did you try “Get Hit Result under Cursor by Objects” yet?

If you just want to check for AI characters this seems like the easier solution.

Thanks a lot man, that works. But just out of curiosity, I’d like to know the issue with hit result by channel. I mean like if it’s a feature that’s removed from the character root capsule, or if I’m facing a bug in my project. Because the default pawn class seems to handle it well, it’s only the character that’s having this issue.

Yeah we’re trying to repro this to see if it’s a bug. This behavior should not have been removed.

Not quite sure to be honest.

I had similar struggles and just completely went to by objects because in most cases it’s exactly what I want anyway. I usually only scan for dynamic objects anyway :wink:

Since you are testing this in the default template, could you try this setup in a new template:

Add a ‘Get Display Name’ and ‘Print String’ node to the end of the Move To Hit Location function inside of the MyController blueprint.

This is the results that I’m getting.

Post back and let me know what you see.

It’s working fine in a new Top Down template now, I’ll try out your code and let you know in 5 min.

Alright, fixed it. The character in my level had visibility trace set to the default ignore value, while my blueprint had it set to block. Changing the values in the editor details for my character took care of the issue. I should have checked that instead of assuming that the change would be reflected there as well. :expressionless: Thanks for the help.