GetHitResultUnderCursorForObjects and EObjectTypeQuery in C++

There are a few questions discussing EObjectTypeQuery on the AnswerHub that were never answered but they are fairly old so I am hoping something has changed in the meantime. I am trying to use GetHitResultUnderCursorForObjects() so something like this

TArray< TEnumAsByte< EObjectTypeQuery > > objects;

 FHitResult hitResult;
if ( GetHitResultUnderCursorForObjects(objects,true,hitResult))
// Do the stuff...

but how do I know which object ObjectTypeQuery1 corresponds to? Just for concreteness lets say I am trying to find HitResults for objects derived from a class called AShape. Is there any workaround for this? In blueprints you can see the list of objects so I assume it must be possible somehow…

The logic of the pointed method is based on “collision channels” and not directly on “actor types”. Here you can find more detailed information using BP (of course it applies also to C++): .

For the C++ side, after having properly configured the collision channels as explained in the above link, here is an example on how to fill the input array using both predefined and custom collision channels:

TArray<TEnumAsByte<EObjectTypeQuery> > objTypes;

// From "common" ECollisionChannel values

// From "custom" collision channels.
ECollisionChannel CollisionChannel;
FCollisionResponseParams ResponseParams;
if (UCollisionProfile::GetChannelAndResponseParams(FName(TEXT("MyChannel")), CollisionChannel, ResponseParams))