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.
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.
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.