Babylon.js built-in primitives (BABYLON.MeshBuilder.*
)
1. Solid / volumetric meshes
- Box –
CreateBox
- Sphere / Ellipsoid –
CreateSphere
- Ico-sphere –
CreateIcoSphere
- Capsule –
CreateCapsule
- Cylinder / Cone –
CreateCylinder
- Torus –
CreateTorus
- Torus Knot –
CreateTorusKnot
- Disc –
CreateDisc
- Polyhedron family (15 presets + custom) –
CreatePolyhedron
- Plane –
CreatePlane
- Ground –
CreateGround
- Tiled Ground –
CreateTiledGround
- Ground from Height-Map –
CreateGroundFromHeightMap
(All share the same "updatable" option and return a standard Mesh
)
2. Surface / parametric meshes
- Ribbon –
CreateRibbon
- Tube –
CreateTube
- Lathe –
CreateLathe
- Extrude Shape –
ExtrudeShape
/ExtrudeShapeCustom
- Extrude Polygon –
ExtrudePolygon
- Polygon / irregular polygon –
CreatePolygon
- 3-D Text (extruded glyphs) –
CreateText
(needs Earcut + font JSON)
3. Line-based meshes
- Lines –
CreateLines
- Dashed Lines –
CreateDashedLines
- Line System –
CreateLineSystem
Usage pattern
const mesh = BABYLON.MeshBuilder.CreateBox("box", { size: 2, updatable: true }, scene);
(Replace CreateBox
with any function above; options vary per primitive.)
Heads-up
Lathe
andCreatePolygon
can't be updated in-place; rebuild instead.CreatePolygon
,ExtrudePolygon
, andCreateText
rely on the Earcut triangulation library.- Older
BABYLON.Mesh.Create*
helpers still exist for backward compatibility but lack the richer option objects.
That's the complete list of primitives available in Babylon.js 8.x.