Dear Gogata256,
You have to specify which Object types you are looking for when you call the function:
Signature:
bool GetHitResultUnderCursorForObjects ( const TArray< TEnumAsByte< EObjectTypeQuery > > & ObjectTypes, bool bTraceComplex, FHitResult & HitResult )
Implementation
//Init the Array
TArray< TEnumAsByte< EObjectTypeQuery > > ObjectTypes;
ObjectTypes.Add(EObjectTypeQuery::ObjectTypeQuery1);
ObjectTypes.Add(EObjectTypeQuery::ObjectTypeQuery2);
//... any other types you want
FHitResult Hit;
bool bHitOccurred = GetHitResultUnderCursorForObjects(ObjectTypes,true,Hit);
if(bHitOccurred)
{
//utilize Hit.GetActor() to know who was hit
}
The enum is not particularly C++ friendly, here’s the whole enum, probably better to use this particular function in BP or write your own version in C++.
EngineTypes.h
UENUM(BlueprintType)
enum EObjectTypeQuery
{
ObjectTypeQuery1 UMETA(Hidden),
ObjectTypeQuery2 UMETA(Hidden),
ObjectTypeQuery3 UMETA(Hidden),
ObjectTypeQuery4 UMETA(Hidden),
ObjectTypeQuery5 UMETA(Hidden),
ObjectTypeQuery6 UMETA(Hidden),
ObjectTypeQuery7 UMETA(Hidden),
ObjectTypeQuery8 UMETA(Hidden),
ObjectTypeQuery9 UMETA(Hidden),
ObjectTypeQuery10 UMETA(Hidden),
ObjectTypeQuery11 UMETA(Hidden),
ObjectTypeQuery12 UMETA(Hidden),
ObjectTypeQuery13 UMETA(Hidden),
ObjectTypeQuery14 UMETA(Hidden),
ObjectTypeQuery15 UMETA(Hidden),
ObjectTypeQuery16 UMETA(Hidden),
ObjectTypeQuery17 UMETA(Hidden),
ObjectTypeQuery18 UMETA(Hidden),
ObjectTypeQuery19 UMETA(Hidden),
ObjectTypeQuery20 UMETA(Hidden),
ObjectTypeQuery21 UMETA(Hidden),
ObjectTypeQuery22 UMETA(Hidden),
ObjectTypeQuery23 UMETA(Hidden),
ObjectTypeQuery24 UMETA(Hidden),
ObjectTypeQuery25 UMETA(Hidden),
ObjectTypeQuery26 UMETA(Hidden),
ObjectTypeQuery27 UMETA(Hidden),
ObjectTypeQuery28 UMETA(Hidden),
ObjectTypeQuery29 UMETA(Hidden),
ObjectTypeQuery30 UMETA(Hidden),
ObjectTypeQuery31 UMETA(Hidden),
ObjectTypeQuery32 UMETA(Hidden),
ObjectTypeQuery_MAX UMETA(Hidden)
};