How to get vertex positions of spline mesh component in world space?

Vertex positions of static mesh component can be calculated by applying component’s transform to position buffer of static mesh (as showed and explained in this thread:

Do I have to manually apply spline transformations to vertices of a static mesh or world positions are stored somewhere?

Figured out how to convert vertex poistions from asset (static mesh) to spline. The following method is used in StaticMesh.cpp, in function static void GetStaticLightingVertex ( and also in vertex shader for spline meshes

this function transforms position in static mesh space to spline mesh space:

FVector StaticMeshToSplineMeshVertexPosition(const FVector& StaticMeshVertexPosition, USplineMeshComponent* SplineMeshComponent)
	const float VertexPositionAlongSpline = StaticMeshVertexPosition[SplineMeshComponent->ForwardAxis];
	const FTransform StaticMeshToSplineMeshTransform = SplineMeshComponent->CalcSliceTransform(VertexPositionAlongSpline);
	FVector SlicePos = StaticMeshVertexPosition;
	SlicePos[SplineMeshComponent->ForwardAxis] = 0;
	const FVector SplineMeshSpaceVector = StaticMeshToSplineMeshTransform.TransformPosition(SlicePos);
	FVector ResultPos = SplineMeshSpaceVector;
	return SplineMeshSpaceVector;

this code gets positions of all vertices of USplineMeshComponent in world space:

UStaticMesh* StaticMesh = SplineMeshComponent->GetStaticMesh();

const FStaticMeshLODResources& RenderData = StaticMesh->RenderData->LODResources[0];
for (uint32 Index = 0; Index < RenderData.PositionVertexBuffer.GetNumVertices(); Index++)
	const FVector StaticMeshSpacePosition = RenderData.PositionVertexBuffer.VertexPosition(Index);
	const FVector SplineMeshSpacePosition = StaticMeshToSplineMeshVertexPosition(StaticMeshSpacePosition, SplineMeshComponent);
	const FVector WorldSpacePosition = SplineMeshComponent->GetComponentLocation() + SplineMeshComponent->GetComponentTransform().TransformVector(SplineMeshSpacePosition);


I still have no idea why you have to do this

 SlicePos[SplineMeshComponent->ForwardAxis] = 0; 

but it works

Hi AlekseyIlin,

do you have any idea about how to do this using blueprints ?

Alright, just found it :slight_smile:
With “get end position” and “Transform Location” nodes, I get the world location of the end point of my spline mesh component.

Hi Alekseyllin:

Is there still some code on github floating around, in regards to how to do this? Thanks