Strictly yes.
Since I want to have custom lighting, or tinting per vertex.
I’m Using the code provided here on the forums and wiki:
Inside(GeneratedMesh.h):
USTRUCT(BlueprintType)
struct FCustomMeshTriangleVertex
{
GENERATED_USTRUCT_BODY()
UPROPERTY(EditAnywhere, Category = Triangle)
FVector Position;
UPROPERTY(EditAnywhere, Category = Triangle)
FColor Color; // 4 inputs
UPROPERTY(EditAnywhere, Category = Triangle)
float U;
UPROPERTY(EditAnywhere, Category = Triangle)
float V;
};
And the color doesn’t change the rendered mesh.
I even modified the FGeneratedMeshSceneProxy class to test if it works:
Inside(GeneratedMesh.cpp):
for (int TriIdx = 0; TriIdx<Component->GeneratedMeshTris.Num(); TriIdx++)
{
const FColor VertexColor(255, 0, 0, 255); // test to see if vertex is rendered red
FCustomMeshTriangle& Tri = Component->GeneratedMeshTris[TriIdx];
const FVector Edge01 = (Tri.Vertex1.Position - Tri.Vertex0.Position);
const FVector Edge02 = (Tri.Vertex2.Position - Tri.Vertex0.Position);
const FVector TangentX = Edge01.SafeNormal();
const FVector TangentZ = (Edge02 ^ Edge01).SafeNormal();
const FVector TangentY = (TangentX ^ TangentZ).SafeNormal();
FDynamicMeshVertex Vert0;
Vert0.Position = Tri.Vertex0.Position;
//Vert0.Color = Tri.Vertex0.Color;
Vert0.Color = VertexColor;
Vert0.SetTangents(TangentX, TangentY, TangentZ);
Vert0.TextureCoordinate.Set(Tri.Vertex0.U, Tri.Vertex0.V);
int32 VIndex = VertexBuffer.Vertices.Add(Vert0);
IndexBuffer.Indices.Add(VIndex);
… etc
Also, if you seen my links, the first one is the question I posted. The picture in it is the game im working on. As you can tell I’ve already added the material to it using cpp. I am trying to make lighting effects similar to BrickGame:
https://.com/AndrewScheidecker/BrickGame
I just need a basic example to work.
Also if you enable physics in the custom mesh:
TSubobjectPtr<UGeneratedMesh> Mesh;
FBodyInstance* BodyInst = Mesh->GetBodyInstance();
BodyInst->bSimulatePhysics = true;
It for some reason destroys the actor. Still not sure why.
Also debugged the ReceiveHit function, and the GeneratedMesh recieves a collision response from everything besides itself. So yes colllision works with custom mesh, but not with other custom meshes. That’s what i’ve discovered so far.