Convert PrimitiveMesh to ArrayMesh?

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

Is there a way to convert PrimitiveMesh (like CubeMesh, PrismMesh, etc.) to ArrayMesh via script?

:bust_in_silhouette: Reply From: Vikrant

you can easily do this with surface tool by using comit() function

var surface_tool := SurfaceTool.new()
surface_tool.create_from(your_primitive_mesh,0)
var array_mesh := surface_tool.commit()

check out docs for more help