How to create my own collision object channel in C++?

Hi, I recently created an object channel under editor project settings , but I can’t access this channel under C++, so I need to create it using C++ to access and implement it… please help me how I can do it?
Here I created the channel Land which blocks everything, I used it to block actors when they are spawned.

Thank You

1 Like

in order to use this custom channels
epic recommend to define in your local file

  • i.e. #define COLLISION_WEAPON
    ECC_GameTraceChannel1 and make sure you customize these it in INI file by
    in DefaultEngine.ini [/Script/Engine.CollisionProfile] GameTraceChannel1=“Weapon”
    also in the INI file, you can override collision profiles that are defined by simply redefining
    note that Weapon isn’t defined in the BaseEngine.ini file, but “Trigger” is defined in Engine
    +Profiles=(Name=“Trigger”,CollisionEnabled=QueryOnly,ObjectTypeName=WorldDynamic, DefaultResponse=ECR_Overlap, CustomResponses=((Channel=Visibility, Response=ECR_Ignore), (Channel=Weapon, Response=ECR_Ignore)))
1 Like

Thank You sir for the detail Information, I will try my best to solve this issue :slightly_smiling_face:

I Solved it thank You very much for help.

In my Engine.ini file
+DefaultChannelResponses=(Channel=ECC_GameTraceChannel1,Name="Land")

So I just defined in the MyTestClass:
#define Land ECC_GameTraceChannel1

and assessed:
GetWorld()->LineTraceSingleByChannel(OutHit, Start, End, Land, TraceParams);

2 Likes