LineTraceByChannel with Array contains search

I need to check to see if an array contains a certain static mesh, this needs to be performed each time a LineTraceByChannel hits something, however I’m not sure how to accomplish this.

Here’s what I’ve got thus far:

I’ve got an array containing the static mesh I want to check for, at the moment it just contains a single drawer mesh that belongs to a larger mesh.

What I don’t know is how to cast from the Break Hit Result, either ‘Hit Actor’ or ‘Hit Component’ to perform the check. I don’t know what I need to cast to, or even if I need to cast to anything.

I just want to break the hit, see if the thing that was hit is in the array, if so, do some fun stuff.

If anyone could offer any advice, I’d greatly appreciate it.

Thanks

would that work comparing static mesh array with an actor from the line trace?

when you dont know what you are casting to, Interfaces are your friend. implement interface on the class you want to respond to it and simple call it from the line Trace, you can set up the Interface to return the mesh value. then simply do a is valid or straight IsEqual to whatever you are comparing too. if you dont know what you are comparing yet, the IsValid is what should work for you, since objects without the Interface would return null.

hope it helps.

here i did an extended explanation on this type of issue, just modify the interface to retrieve whatever value you need from the HitActor candidate

Ah I missed part where openableThings was a Static Mesh array, I’ve updated my original post with a small modification. Thanks jblaswu!