LineTrace == always returns false?

In this blueprint I am attempting to check if the BP_Planter is placed next to another BP_Planter. If it is then a broder isn’t required. (and visa versa)

I added a print string to make sure and it is saying that the line trace has indeed hit the BP_Planter but the == returns false regardless. As you can see in the viewport it is hitting the planter but the branch after the print string still returns false.

In the viewport you can see that i have already spawned in 1 BP_Planter (left) and then the second one (right) is running the line trace and is showing the hit line.

My plan is to run 4 of these (x+, x-, y+ and y-) but am just doing one to start with to get it working.

I’m sure im missing something basic here. hopefully someone can point it out to me.

I tried linetracing through another object.

I could not get it to work with “== object” node, either.

However, casting to the other object (in your case, BP_Planter) worked. I would use this approach instead.

You could also get the object’s class and then do a comparison.

I don’t think the object comparisons are intended to be used without a direct reference to a specific object instance in the scene, even though it has a drop-down menu.

Thanks JoSf, using the GetClass == worked straight away.

I do find it odd that the == object doesnt work though, I wonder if this is by design or is a bug?

If you need the boolean, I would rather use the cast node. If you need the returning boolean, you can right click on the cast node and select “convert to pure cast” from the drop-down. One less node to go with.

I think the reason why == object does not work because it is trying to compare to a specific object instance, not the objects in general. If it did so in general, then == object and == class nodes would do exactly the same thing.

If this is correct then the node having a drop-down selection is rather misleading as it is useless, since you need to get a reference somehow. That works.

I would say if that is the case, it’s more of a design oversight. The node might be based on the same logic as the other nodes, so it just has a drop-down selection by default. Also, calling the node as “== object instance” or something would be more accurate.

Good point. thanks again.