Download

UProceduralMeshComponent collision

I am new to unreal, and I have been messing around with the UProceduralMeshComponent, and I wanted to give it collision. I tired using AddCollisionConvexMesh() but I can’t get it to do anything.

AddCollisionConvexMesh should work, I’m using it myself. What kind of point data are you giving it?



ConvexVerts.Add(FVector(0, 0, -1000));
ConvexVerts.Add(FVector(0, 1000, -1000));
ConvexVerts.Add(FVector(1000, 1000, -1000));
ConvexVerts.Add(FVector(1000, 0, -1000));

ProceduralMesh->AddCollisionConvexMesh(ConvexVerts);


I think you need to give it some volume. All your points are on a z=-1000 flat plane. A convex mesh will usually need some thickness to be able to do collision properly.


ConvexVerts.Add(FVector(0, 0, -1000));
ConvexVerts.Add(FVector(0, 1000, -1000));
ConvexVerts.Add(FVector(1000, 1000, -1000));
ConvexVerts.Add(FVector(1000, 0, -1000));

// give the quad some depth of 5m
ConvexVerts.Add(FVector(0, 0, -1500));
ConvexVerts.Add(FVector(0, 1000, -1500));
ConvexVerts.Add(FVector(1000, 1000, -1500));
ConvexVerts.Add(FVector(1000, 0, -1500));

ProceduralMesh->AddCollisionConvexMesh(ConvexVerts);