How to use a static mesh as it's own collision? (At runtime in C++)

Is there any precise answer on this question? I found this piece of code which does generate collision, but I can’t make my character actually collide with the collision.

	staticMesh->CreateBodySetup();
	auto* BS = staticMesh->GetBodySetup();

    // This part is to remove the generated simple collisions
	BS->AggGeom.BoxElems.Empty();
	BS->AggGeom.SphereElems.Empty();
	BS->AggGeom.SphylElems.Empty();
	BS->AggGeom.ConvexElems.Empty();

	BS->CollisionTraceFlag = ECollisionTraceFlag::CTF_UseComplexAsSimple;
	BS->InvalidatePhysicsData();
	BS->CreatePhysicsMeshes();