What's the best way to do dynamic geometry in 3D?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Anna Harren

2D nodes get a _draw virtual function, but there’s nothing similar for Spatial nodes. What is the best way to create new geometry at runtime? Is creating new meshes every frame a good idea? Are there some less-obvious ways to draw geometry than MeshInstance? How does GridMap do its dynamic geometry? Could I make my own class inheriting from VisualInstance, and if so, how would that draw?

By drawing geometry, do you mean create new polygons? With vertices and normals and all? That can be done in a few ways according to the docs. Procedural geometry generation — Godot Engine (3.1) documentation in English
ImmediateGeometry is a node that creates new geometry on the fly, but since it operates in real time, it is expensive and should be used for simple geometry only.
SurfaceTool is another way to create polygons once and then make the appear in game.
Finally, you have arrays which you turn into meshes.

johnygames | 2019-07-22 09:25

:bust_in_silhouette: Reply From: MakLinux

One way