Creating Set Shapes
Common 3D Shapes
These common shapes cover 2D shapes such as horizontal planes (ground), vertical planes and regular polygons along with 3D shapes such as cuboids, spheres, ellipsoids and toruses.
To create these meshes you use
import { MeshBuilder } from "@babylonjs/core/Meshes/meshBuilder";const mesh = MeshBuilder.Create < MeshType > (name, options, scene);where the options object properties vary according to the type of mesh. Using an empty object, , makes the meshes default to preset sizes, usually unit ones. The scene parameter is optional and defaults to the current scene.
Two useful properties are updatable and instance. When a parametric mesh is created with its updatable option set to true, you can change the values within the shape-defining properties and re-render the mesh with those new values by using the instance property, as the following line-drawing example shows.
import { Vector3 } from "@babylonjs/core/Maths/math.vector";import { MeshBuilder } from "@babylonjs/core/Meshes/meshBuilder";//creates lines using the vector3 myPoints arrayconst myLines = MeshBuilder.CreateLines("lines", { points: myPoints });// update some or all values in myPoints arraymyPoints[1] = new Vector3(1, 2, 3);// updates the existing instance of myLines by pointing the instance property to itmyLines = MeshBuilder.CreateLines("lines", { points: myArray, instance: myLines });While you can change values within a property, you cannot change the number of elements in that property. All the parametric meshes, except for the Lathe, CreatePolygon, and ExtendPolygon, can have their shape updated in this way.
It is still possible to use the form
import { Mesh } from "@babylonjs/core/Meshes/mesh";const mesh = Mesh.Create<MeshType>(name, required_param1, required_param2, ..., scene, optional_parameter1, ........);The scene parameter is required when optional parameters are used. You will still find this method in playgrounds.
Coming next
Creating A Box
Learn how to create a box in Babylon.js.

Creating A Tiled Box
Learn how to create a tiled box in Babylon.js.

Creating A Sphere
Learn how to create a sphere in Babylon.js.

Creating A Cylinder
Learn how to create a cylinder in Babylon.js.

Creating A Capsule
Learn how to create a capsule in Babylon.js.

Creating A Plane
Learn how to create a plane in Babylon.js.

Creating A Tiled Plane
Learn how to create a tiled plane in Babylon.js.

Creating A Disc
Learn how to create a disc in Babylon.js.

Creating A Torus
Learn how to create a torus in Babylon.js.

Creating A Torus Knot
Learn how to create a torus knot in Babylon.js.

Creating A Ground
Learn how to create a ground in Babylon.js.

Creating Ground From a Height Map
Learn how to create ground from a height map in Babylon.js.

More On Height Maps
Learn more about height maps in Babylon.js.

Creating A Tiled Ground
Learn how to create a tiled ground in Babylon.js.

Creating A 3D Text object
Learn how to create 3D text in Babylon.js.
