How do you make a mesh through code?

I am trying to create a voxel terrain system in Unreal Engine. I have little experience with the engine, and have spent most of my time developing with Unity. In Unity, you can create a mesh and quickly build it by assigning arrays of vertices and triangle data. Using this system, I easily created a cube-based voxel terrain system. I want to do something similar in unreal.

My goal right now is to make a “MeshData” class that will act as a wrapper, which will have various methods I can call to edit the aspects of a mesh with ease. I will also be able to combine MeshDatas with helper methods, which will make it easy for me to build entire regions together as chunks. Things I want to edit procedurally with code include:

  • Vertex Positions
  • Triangle Indices
  • Vertex Colors
  • UV Map Coordinates
  • Secondary UV Map Coordinates
1 Like

I would take a look at this:

There are other plugins available, some are included in the engine.