From 933bf9652385c7e63418bc52f2c8e2bb2311d577 Mon Sep 17 00:00:00 2001 From: Ryan Roden-Corrent Date: Wed, 15 Jul 2020 08:09:27 -0400 Subject: [PATCH] Clarify how to convert PrimitiveMesh to ArrayMesh. It took me a bit to figure this out, as I was initially doing something more complicated like this before I realized I just had to pass get_mesh_arrays directly to add_surface_from_arrays. ``` var arr_mesh = ArrayMesh.new() var arrays = [] arrays.resize(ArrayMesh.ARRAY_MAX) arrays[ArrayMesh.ARRAY_VERTEX] = c.get_mesh_arrays() arr_mesh.add_surface_from_arrays(Mesh.PRIMITIVE_TRIANGLES, arrays) ``` --- doc/classes/PrimitiveMesh.xml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/doc/classes/PrimitiveMesh.xml b/doc/classes/PrimitiveMesh.xml index 77915bc5380..9e7f26ed4f8 100644 --- a/doc/classes/PrimitiveMesh.xml +++ b/doc/classes/PrimitiveMesh.xml @@ -13,7 +13,12 @@ - Returns mesh arrays used to constitute surface of [Mesh]. Mesh arrays can be used with [ArrayMesh] to create new surfaces. + Returns mesh arrays used to constitute surface of [Mesh]. The result can be passed to [method ArrayMesh.add_surface_from_arrays] to create a new surface. For example: + [codeblock] + var c := CylinderMesh.new() + var arr_mesh := ArrayMesh.new() + arr_mesh.add_surface_from_arrays(Mesh.PRIMITIVE_TRIANGLES, c.get_mesh_arrays()) + [/codeblock]