@
“It doesn’t work it a packed game.”
I have had the same experience and reported to epic a while back ![]()
I’ve experienced with getting vertex locations in packaged games since 4.3
If you start a new Answerhub, link me and I can add more info to your report ![]()
Please include your pictures and then I can add info, you could also add my code below to the initial post.
For Epic Staff:
Here's the code being used that works perfect in pre-packaged game and does not work in packaged game.
**It seems that using the Render Data / LOD info in packaged game** does not work some reason?
```
Comp->StaticMesh->RenderData->LODResources[0].PositionVertexBuffer
```
Is there an after-packaging better way to get the vertex position info?
Please note the rotation/translation of each vertex is scaled by the FTransform to match actor scaling and rotation.
```
Comp->GetComponentLocation() + RV_Transform.TransformVector(VertexBuffer->VertexPosition(Itr))
```
Entire C++ Code
bool UVictoryBPFunctionLibrary::GetStaticMeshVertexLocations(UStaticMeshComponent* Comp, TArray<FVector>& VertexPositions)
{
if(!Comp) return false;
if(!Comp->IsValidLowLevel()) return false;
//~~~~~~~~~~~~~~~~~~~~
// Vertex Buffer
if(! Comp) return false;
if(! Comp->StaticMesh) return false;
if(! Comp->StaticMesh->RenderData) return false;
if( Comp->StaticMesh->RenderData->LODResources.Num() < 1) return false;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//~~~ End of Pointer Safety Checks ~~~
//~~~~~~~~~~~~
VertexPositions.Empty();
//~~~~~~~~~~~~
FPositionVertexBuffer* VertexBuffer = NULL;
VertexBuffer = & Comp->StaticMesh->RenderData->LODResources[0].PositionVertexBuffer;
if(!VertexBuffer) return false;
//~~~~~~~~~~~~~~~~
int32 VertexCount = VertexBuffer->GetNumVertices();
FTransform RV_Transform = Comp->GetComponentTransform();
for(int32 Itr = 0; Itr < VertexCount; Itr++)
{
VertexPositions.Add(
Comp->GetComponentLocation() + RV_Transform.TransformVector(VertexBuffer->VertexPosition(Itr))
);
}
return true;
}