Converting collision channel to trace type query
UKismetSystemLibrary
traces like SphereTraceSingle
, BoxSphereSingle
etc. take ETraceTypeQuery
type to determine objects the trace should collide. This is counter intuitive for me since if you attempt to trace using UWorld
sweep functions they take ECollisionChannel
instead.
There is a class in the engine code, UEngineTypes
. It has a function called ConvertToTraceType
.
So to convert ECollisionChannel
to ETraceTypeQuery
simply call:
ETraceTypeQuery TypeQuery = UEngineTypes::ConvertToTraceType(ECC_WorldStatic);