Physics not working on UProceduralMeshComponent

I’m creating a procedural mesh, but I can’t make the physics work.

The creation looks something like this:



mesh = NewObject<UCustomProceduralComponent>(mParentObject, tempName);

mesh->CreateMeshSection(groupcounter, vertices, indices, normals, uvs, vertexColors, tangents, mCreateCollisionShell);
mesh->bUseComplexAsSimpleCollision = false;
mesh->SetSimulatePhysics(true);
mesh->RegisterComponent();


But at start I get this errors right away:

PIE:Warning: Warning Trying to simulate physics on ‘’/Game/FirstPersonCPP/Maps/UEDPIE_0_FirstPersonExampleMap.FirstPersonExampleMap:PersistentLevel.BP_ProceduralMesh’’ but it has ComplexAsSimple collision.
LogPhysics:Error: PHYSX: (d:\build++ue4+release-4.14+physx_compile\sync\engine\source hirdparty\physx\physx_3.4\source\physx\src\NpRigidBodyTemplate.h 479) eINVALID_PARAMETER : RigidBody::setRigidBodyFlag: dynamic meshes/planes/heightfields are not supported!

This happens for every procedural mesh I’m creating. After this error it just stands there with no physics.

The weird thing is that is says that ComplexAsSimple collision is on, but I manually set it to false when I create the mesh. What am I doing wrong?

My mistake, I discovered that I should set



mesh->bUseComplexAsSimpleCollision = false;


BEFORE creating the mesh section.