Hit Result "Object Type"


I am currently using the “Single Line Trace for Objects” and one thing I am really missing is the ability to Break the Hit Results and get the Object Type of the Hit.
For example when I am using multiple Object Types in an Array to fire in the Line Trace and if it Hits I want to first check which kind of Object is has hit from its Type to proceed in a slightly different way.
I don’t really want to be forced to use Multiple “Single Line Trace for Objects” just for slightly different Results.
Single Line Trace for Object with (ItemKind1, ItemKind2, SpecialKind1) and For ItemKind2 I want to do the same as ItemKind1 just use another Blueprint Interface, and for SpecialKind I want to check first If I am able to do that and then do the Same as the Rest.
But thats just not possible without Multiple Single Line Traces at the moment, so a Break Hit Results where you can get the ObjectType and compare it would be much better for my needs.


You can cast the hit actor or component to the classes you want to check, then do what you want if it’s valid, or do another cast if it’s not and check if that’s valid.

That would be way more performance heavy than just having a “saved value” of it in the already created “Hit Result” struct. Also I have a lot of classes that would need to be checked instead of just checking 1 simple Value that is already being used as a HitResult.
I know there are other ways of doing stuff, but a HitResult with the ObjectType would be much faster and easier to use than these workarounds.

Why would it be way more or any more performance heavy? If you have a saved class, it’s going to have the check the to see if the saved value’s class is equal to the class of the hit result anyway. It’s not like casting takes much time at all.

Why would you be able to check only 1 simple value on the hit result if you did what you wanted instead of a lot of classes like you can do with casting?

Maybe I am not understanding what you want to do. What sort of object would this “saved value” be in the hit result?

Okay I try to explain better. For example I have a Single Line Trace for Objects.These Objects Types are “EObjectTypeQuerry” and contains an array for different Collision Object Channels. In the Single Line Trace every “hit/overlap” would be checked if it is in the “EObjectTypeQuerry” array I used as input. If it does It gives me a Hit Result and I would like there in the HitResult to also be the “EObjectTypeQuerry” that hit it off.
When I have got like 8 Different “EObjectTypeQuerry” I fire with a Single Trace but want different things to happen on different Traces It would be very easy to just Check the “EObjectTypeQuerry” Hit Result with another “EObjectTypeQuerry” to branch of. Then It can directly go and cast in the right direction without haveing so potential cast through mutliple classes until the desired class is found or not. If you know what I mean.
I might be wrong and Casting at every hit every class to find the right class from the hit component is totally okay, but I would find a simple “Get Hit EObjectTypeQuerry” from the “Break Hit Result” much easier to use and would be easier to change the following code If new Collisions are in.

Alright that makes a lot more sense than what I thought you wanted to do.

What exactly are you trying to get from those line traces. Maybe there is a better way to do it that will work for what you want to do.