I’m trying to use a line trace to detect the surface that the player is on, but I want to ignore some things in the scene (Landscape, specifically, since it blocks a lot of surfaces). I created a custom “surface” object type, but I can’t figure out how that fits into the FCollisionObjectQueryParams argument of LineTraceSingleByObjectType().
FCollisionObjectQueryParams(ECC_GameTraceChannel1) or FCollisionObjectQueryParams(ECC_GameTraceChannel2) and etc.
Thanks! That seemed like the right direction, but where do I set/find which numbered TraceChannel corresponds to which TraceChannel name?
Wait okay, I needed to use FCollisionObjectQueryParams(ECC_TO_BITFIELD(ECC_GameTraceChannel1)) and that seemed to work
Solution for newer engine version (5.0.3)
It seems to have gottent much simpler to do.
When making your
FCollisionObjectQueryParams colParamsObject = FCollisionObjectQueryParams();
colParamsObject.AddObjectTypesToQuery(ECC_WorldStatic); // UNREAL set
// simply do this: (count the position of the type in your ProjectSettings. Starts at 1 and not 0 (for programmers)
colParamsObject.AddObjectTypesToQuery(ECC_GameTraceChannel5); // YOURs added
For consistency you may reference and custom name all your custom trace channels in one .h and include it. Ie the ProjectName.h as such:
#define EEC_InivisbleWall_AI ECC_GameTraceChannel5
// and use as:
colParamsObject.AddObjectTypesToQuery(EEC_InivisbleWall_AI);
Sorry for revival. Hopefully this helps new ppl instead of going threw 10s of deprecated posts