As a Roblox developer, it is currently extremely hard (and unreasonably expensive, performance wise) to generate geometry at runtime. Realtime CSG is very often too expensive or not suited to the task at hand, especially when dealing with primitive objects such as shapes or lines.
Being able to create and modify meshes at runtime would create a lot of possibilities that were previously impossible or hacky to do within performance constraints, such as:
- A game where you can draw in 2d with vector objects
- A plugin which creates 2d and 3d primitives with any number of points, size, and other customizable factors
- Triangle terrain without wedges; reducing the polygon count
While all of these are possible with realtime CSG, they would be unreasonable for actual games thanks to the complexity and speed required. Not to mention that realtime CSG is only available on the server, and is wildly unpredictable when it comes to computational errors and such.
If the Roblox engine had this feature, it would open many possibilities to new and innovative technologies developers can create and use in their games.
Suggested implementation (example)
local Vertex = MeshVertex.new(
Vector3.new(1, 2, 3), -- Position
Vector2.new(0.25, 0.05), -- UV location
Color3.new(1, 1, 1) -- Color
)
local Face = MeshFace.new(
Vertex, Vertex, Vertex,
Vector3.new(0, 1, 0) -- Surface normal (could potentially be automatic)
)
local Info = MeshInfo.new({
Face, Face
})
local Mesh = Instance.new("UserMesh", Part)
Mesh.TextureId = "rbxassetid://000000000"
Mesh:ApplyCustomMesh(Info)