Hello there
I would like to create a Mesh from several points (world coordinates if possible), by clicking on the ground to draw a shape for instance.
I did some researches beforehand, and roughly found two ways I can explore :
- Using Procedural Mesh (Procedural Mesh Component), where I need to give vertices, triangles and so on. A similar post would be this : Dynamical mesh in blueprint from array of vertex-coordinates of the polygon perimeter in the space? . But it may not be the way to do it anymore ( Reddit - Mesh generation in Unreal Engine ) ?
- Using the plugin GeometryScript, but it’s experimental and its documentation is still scarce. It seems to be really powerful when seeing this like this or more impressive in this article, but I’m struggling to use it. I somewhat managed to add vertices to a mesh, and of course nothing is visible in game so things are still missing, but I don’t know what (creating normals ? UVs ?)
Here is the code I wrote
const TSharedPtr<TArray<FVector>> sharedVertices = MakeShared<TArray<FVector>>(vertices);
FGeometryScriptVectorList verticesList = FGeometryScriptVectorList { sharedVertices };
const TSharedPtr<TArray<int>> indexes = MakeShared<TArray<int>>();
FGeometryScriptIndexList indexesList = FGeometryScriptIndexList { EGeometryScriptIndexType::Vertex ,indexes };
UDynamicMesh* myDynMesh = this->DynamicMeshComponent->GetDynamicMesh()->Reset();
UGeometryScriptLibrary_MeshBasicEditFunctions::AddVerticesToMesh(myDynMesh, std::move(verticesList), indexesList);
Any advice ?
Thank you ^^