How to Enable/Disable a StaticMeshComponent Collision

I create a custom StaticMeshComponent inherited from UStaticMeshComponent. I want to enable/disable the Collision of mesh at runtime. The Disable work ok. But once I disable the collision, I can’t enable the Collision for overlapping correctly even though setting the ‘Collision Enabled’ to ‘Query and Physics’. So I want to know how to control the collison at runtime, and even if I could, should I ask for How the Collision system works on StaticMeshComponent and the difference with Actor.


I would expect that changing between ‘Disabled’ to ‘Query and Physics’ would work as long as you are doing this by calling UPrimitiveComponent::SetCollisionEnabled

Actors have the ability to disable collision regardless of the component setting. This is found here AActor::bActorEnableCollision

You can debug this by checking FBodyInstance::GetCollisionEnabled and seeing what it returns.