I’m currently developing a plugin for UE4.23. I’m looking for a solution to my problem that doesn’t involve modifying the source code of Unreal, the plugin needs to be able to stand on its own.
I need to access the vertex positions of a skeletal mesh once every frame. I do not need to modify the vertices, only access/copy them. I’m currently retrieving the vertices using the following code:
USkeletalMeshComponent * sm_component; TArray<FVector> vertex_array; ... sm_component->GetCurrentRefToLocalMatrices(ref_to_local_m, 0); USkeletalMeshComponent::ComputeSkinnedPositions(sm_component, [INDENT=9]vertex_array, ref_to_local_m, sm_render_data->LODRenderData, *skin_weight_vb);[/INDENT]
Which fills vertex_array with the data I need. However, it is too slow for what I’m doing. The skeletal mesh contains ~15k vertices and ComputeSkinnedPositions](USkinnedMeshComponent::ComputeSkinnedPositions | Unreal Engine Documentation) slows down my application significantly.
I’ve also tried GetCPUSkinnedVertices, but sadly, as the documentation says:
This means that I can’t really use any of the two functions, unless I am doing something wrong which I can’t see.
I’m wondering if there is a faster way of retrieving the vertex positions of a skeletal mesh?