Box trace is hitting static mesh, but BRANCH wont work

Ok, I am very crazy, I dont know what is wrong now.

So here is my BP code for box trace in my test truck, and it is working great (landscape is set to ignore trace).

And in front of my truck, I have fence called “ograda1_BP”.

I make a few print string checkers, one is printing what is in box trace, and second and third print condition if my box trace is touching “ograda1_BP”.

97ecd9c2bcf8696e8aac2268fe548744801a209e.jpeg

9d463c97cc96d3ef9ba5f486437a8de8e8893c26.jpeg

dd4d50d1be1db563234f11a7bbbdf34f93e60150.jpeg

Box trace works good, as you can see - it is red and when it touch “ograda1_BP” it change collor to green and print name of touched object.

But why my condition is not working? It is false every time.

Instead of equals, use Get Class, and then do an equals class comparison.

The == node used to trick me like this too. it doesn’t work the way you’re trying, where you are checking to see if the class is == to something. Instead how it works is it checks the reference, so you could check if hit actor == player pawn.

So there’s two solutions, you can get hit actor class, and check if that class == class of ActorYouWant. But a better method is probably casting. Off Hit actor, do Cast To Ograda1_BP. If the cast succeeds, the hit actor is the actor you want, run true. If the cast fails, it’s not the actor you want, run false.

Thanks, this solved my problem!