Download

How to make UProceduralMeshComponent with bDoubleSidedGeometry=true?

I need to use UProceduralMeshComponent to create the mesh I want. But I need doubleSided collision.

pmc = CreateDefaultSubobject<UProceduralMeshComponent>("pmc");

//Omit the steps:create  Verties, Triangles, Normals, UV, VertexColors, Tangents

pmc->GetBodySetup()->bDoubleSidedGeometry = true;
pmc->CreateMeshSection(0, Verties, Triangles, Normals, UV, UV, UV, UV, VertexColors, Tangents, true);
pmc->SetMaterial(0, MeshMaterial);

This doesn’t work. Can someone please help me?

You can create flipped polygons, or if you just need it to render from both sides you can set a flag in your material.

I also have a (pretty old by now) examples for how to build geometry in code, which includes double sided geometry. This uses an alternative to ProceduralMeshComponent called the RuntimeMeshComponent:

It’s not difficult to create flipped polygons, but it will cost 2x triangles…
I already make the material double-sided.
I noticed that there is a parameter “Double Sided Geometry” in blueprint of collision box, which is effective. But the actor is made by c++ which cannot open its blueprint.
The document says that the UBodySetup contains the parameter “bDoubleSidedGeometry”, but I don’t know how to use it.