Hello, I’m currently working with custom object types for collision and I’ve found something really weird in the source code of UCollisionProfile::ConvertToCollisionChannel.
ECollisionChannel UCollisionProfile::ConvertToCollisionChannel(bool TraceType, int32 Index) const
{
if (TraceType)
{
if ( TraceTypeMapping.IsValidIndex(Index) )
{
return TraceTypeMapping[Index];
}
}
else
{
if ( ObjectTypeMapping.IsValidIndex(Index) )
{
return ObjectTypeMapping[Index];
}
}
// invalid
return ECC_MAX;
}
It came from a call to SphereOverlapActors which is given a
const TArray<TEnumAsByte<EObjectTypeQuery> > & ObjectTypes
this will take the EObjectTypeQuery as an int and give it to UCollisionProfile::ConvertToCollisionChannel. The problem is that ObjectTypeMapping does not look like EObjectTypeQuery, so it is impossible that ObjectTypeMapping[Index] returns the good ECollisionChannel.
For example if you give ECC_PhysicBody to the function SphereOverlapActors, it will be converted to the ECollisionChannel ECC_Destructible.
I found this not normal at all, but I’m not very good with unreal collision yet, so maybe I’m using it wrong.