Hi there,
I’m trying to return a vector array that will contain the positions of all the vertices from a static mesh’s collision mesh.
Is this possible? Here is what I have so far…
bool UMyFunctionLibrary::GetCollisionVertices(UStaticMeshComponent* Target, TArray<FVector>& VertexArray)
{
if (!Target || !Target->IsValidLowLevelFast() || !Target->StaticMesh || !Target->StaticMesh->HasValidRenderData())
{
return false;
}
if (!Target->StaticMesh->ContainsPhysicsTriMeshData(true))
{
return false;
}
FTriMeshCollisionData CollisionData;
Target->StaticMesh->GetPhysicsTriMeshData(&CollisionData, true);
VertexArray = CollisionData.Vertices;
return true;
}
But for some reason this returns the actual mesh’s vertices instead of the collision box.
Any tips?