Collision for procedural mesh generation

Hello all!

I use this link, and this link for making collision for generation meshes.
I try include Physic Simulation and after that my mesh flying into the floor and remove from level. If i hadn’t it , my character can jump on it and stoping.

Code which make mesh:

PrimaryActorTick.bCanEverTick = true;
    
    Mesh = CreateDefaultSubobject<UCustomProceduralMeshComponent>(TEXT("ProceduralCube"));
    
    // Generate a cube
    TArray<FCustomProceduralMeshTriangle> triangles;
    GenerateCube(100.f, triangles);
    Mesh->SetProceduralMeshTriangles(triangles);
    Mesh->SetMobility(EComponentMobility::Movable);
    Mesh->SetSimulatePhysics(true);
    Mesh->SetCollisionEnabled(ECollisionEnabled::QueryAndPhysics);
    
    Mesh->AttachTo(RootComponent);
//    RootComponent = Mesh;
    SetActorEnableCollision(true);

How i can include physic simulation and get correct work?

P.S.: I use MacOS.

Thanks for help!

And this link i read too)))

UProceduralMeshComponent::CreateMeshSection(int32 SectionIndex, const TArray& Vertices, const TArray& Triangles, const TArray& Normals, const TArray& UV0, const TArray& VertexColors, const TArray& Tangents, bool bCreateCollision);

When you’re building the mesh, make sure to set the bCreateCollision flag…set the collision channel response as you require and it should work fine.

Thanks that helped me a lot : )

In my case, when using UE 4.17.1 and procedural meshes, the collision only worked in preview mode, but in launch mode, they would not work even with the above suggested flag set to true. I had to add the following line after setting up mesh data:

// Activates building collision data
mesh->ContainsPhysicsTriMeshData(true);

This function is an expression - it does nothing, it only returns information. I think its something else that you did.