How to set properties of BoxCollision in C++?

Hello, this is very easy to do in C++, and it works across all PrimitiveCompontents. Here’s some examples of a few of the functions you can use:

To set the response to WorldStatic objects to Ignore, do this:

Component->SetCollisionResponseToChannel(ECollisionChannel::WorldStatic, ECollisionResponse::ECR_Ignore);


To set the component’s collision settings to the “OverlapAll” preset, you’d do this:
Component->SetCollisionProfileName(TEXT("OverlapAll"));


To set the component’s collision type to “Pawn”:
Component->SetCollisionObjectType(ECC_Pawn);

Please look through the “SetCollision” functions on this list, they are helpful.


I recommend you consider using custom collision presets. You can set them up from Project Settings → Collision and use them with SetCollisionProfileName.

Hope this helps!

2 Likes