I have a strange issue here, and I am not certain what I am doing wrong.
I have a simple top-down game. There are some enemies and I want them to spot the player via a simple line trace. However, when the trace hits the player, it does not return the player pawn (see screenshots): the hit result is invalid.
Strange thing is, when the enemy first does a trace on any other object, then the next time the trace hits the player, it returns a valid result.
What am I doing wrong here? Or is this a problem of the line trace functionality?
Is there nobody who has got an idea why the trace marks my character as invalid?
I have recently found out that what I described earlier (successful trace after first hitting another object) is not true: in this case, when the next trace hits the player character, it returns “valid”, but names the object it hit during the previous trace as hit result.
I had the same issue. I resolved it when I noticed that I had placed my character in the scene, instead of it being spawned on start. My collision had the proper trace channel, yet it would not provide a hit (returning false from the Line Trace by Channel). Once I removed my character in from the scene, it worked.