# UCollisionProfile::ConvertToCollisionChannel does not behave as expected

**URL:** <https://forums.unrealengine.com/t/ucollisionprofile-converttocollisionchannel-does-not-behave-as-expected/432290>\
**Category:** World Creation\
**Tags:** channel, source, unreal-engine, Collision, UE4, question, CPP\
**Created:** [August 23, 2018, 1:04pm UTC](https://forums.unrealengine.com/t/ucollisionprofile-converttocollisionchannel-does-not-behave-as-expected/432290 "2018-08-23T13:04:56Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![benjaml](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@benjaml](https://forums.unrealengine.com/u/benjaml)\
**Post date:** [August 23, 2018, 1:04pm UTC](https://forums.unrealengine.com/t/ucollisionprofile-converttocollisionchannel-does-not-behave-as-expected/432290/1 "2018-08-23T13:04:56Z")

</div>

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.
