Casting hit actor from line trace always fails

Hi,

I am having trouble casting my hit actor from a single line trace to my custom blueprint class (which inherits from Character). I broke the hit result struct, then next cast the hit actor to my custom class (so that I can retrieve a variable from it), but the cast fails every time. I know that the hit result is the correct object because when I print its name, it is correct. Any idea as to why this is the case? Basically, I just need to cast the hit result actor to my custom class, which inherits from the Character class. Thanks in advance.

Can you show screenshot from bp?

He wants to cast the hitresult actor. Why should he get all actors of class? :smiley:

We just need the BP to see what he is doing wrong in his setup or what prevents the Hitactor from getting casted correctly.

before trying to cast, use the node get all actors of class, then cast from that instead,

Thanks for trying to help. I managed to figure this one out by messing around with it. It turns out that it was just a simple problem with my line trace when my character looked up from the baseline, towards where I had just moved the object of interest. The line trace was hitting my character’s own capsule when looking up, as the start point originated from the player’s “eyes”. I just made the line trace ignore the player character. I thought it was still hitting the correct object but I had taken off the print node because I thought I wouldn’t need it anymore. Now I know to only change one thing at a time. Anyway, it is all good now. Thanks for trying to help.