Accessing Vertex Positions of static mesh

Thanks a lot and Rube, this is exactly what I was looking for!

I also needed to get vertex data for volumes (brush actors) and managed to figure that thanks to this thread. Here’s the snippet with brush specific part in bold:



TArray<FVector> vertices = TArray<FVector>();
	TResourceArray<FModelVertex, 0U> modelVertices = **volumeOrBrushActor->Brush->VertexBuffer.Vertices;**

	for (FModelVertex vert : modelVertices)
	{
		const FVector WorldSpaceVertexLocation = volumeOrBrushActor->GetActorLocation() + GetTransform().TransformVector(vert.Position);
		vertices.AddUnique(WorldSpaceVertexLocation);
	}

	return vertices;


A quick digression - can this be simplified further with some functional programming construct?
eg pseudo code: Transform( ModelVerts, FUNC{vert -> actorLocation + GetTransform().TransformVector(vert.Position)} ); would accomplish all of that in one line but I’m not sure of the C++ equivalent.

1 Like