How to get FHitResult.FaceIndex?

When I do

  PlayerController->GetHitResultUnderCursor(ECollisionChannel::ECC_WorldDynamic, false, TraceResult);

TraceResult.FaceIndex is always -1.

Here @OriCohen says that I have to “use a triangle mesh for the query”. Do I have to use GetHitResultUnderCursorForObjects() with “triangle mesh” for the object type? Then how should I do it (EObjectTypeQuery is very obscure to me)?

hi, I’m trying something similar but also can’t get it to work

I’m trying to call ConvertQueryImpactHit() manually so I can convert my original impact to get the FaceIndex

I had to include “PhysX”, “APEX” in my project PublicDependencyModuleNames,

then in my class I added #include “Runtime/Engine/Private/Collision/CollisionConversions.h”

but when I add the call to ConvertQueryImpactHit() I get a linker error about it (unresolved external symbol)

:frowning:

Try to set bReturnFaceIndex and bTraceComplex to “true” in FCollisionQueryParams.