Add/remove vertices to an existing mesh

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

I’ve created a spherical world terrain and I’m looking to manage the LOD on it with a quadtree approach.

Fundamentally, I just want a method that adds/removes vertices.to an existing mesh. Are MeshDataTool and SurfaceTool the right methods for this (something along the lines of the code below) or am I better off with ArrayMesh or some other approach?

func set_lod():
	"""Get verts near player and subdivide for LOD."""
	
    var s_tool = SurfaceTool.new()
    var mesh_data_tool = MeshDataTool.new()

	s_tool.create_from(my_existing_mesh, 0)
	var surface_tool = s_tool.commit()
	
	mesh_data_tool.create_from_surface(surface_tool, 0)
	
	for i in range(mesh_data_tool.get_vertex_count()):
		<insert / remove vertices according to distance from camera> 
		
	s_tool.surface_remove(0)
	mesh_data_tool.commit_to_surface(s_tool)

Don’t worry about the quadtree logic, I just need to know the best way to dynamically insert and remove vertices to a mesh in gdscript as I’m new to the engine.