Provided Polyhedra

Polyhedra Provided by Number

There are fifteen polyhedra that can be created by setting its type number from 0 to 14. These are

typenamenumber of faces
type
0
name
Tetrahedron
number of faces
4
type
1
name
Octahedron
number of faces
8
type
2
name
Dodecahedron
number of faces
12
type
3
name
Icosahedron
number of faces
20
type
4
name
Rhombicuboctahedron
number of faces
26
type
5
name
Triangular Prism
number of faces
5
type
6
name
Pentagonal Prism
number of faces
7
type
7
name
Hexagonal Prism
number of faces
8
type
8
name
Square Pyramid (J1)
number of faces
5
type
9
name
Pentagonal Pyramid (J2)
number of faces
6
type
10
name
Triangular Dipyramid (J12)
number of faces
6
type
11
name
Pentagonal Dipyramid (J13)
number of faces
10
type
12
name
Elongated Square Dipyramid (J15)
number of faces
12
type
13
name
Elongated Pentagonal Dipyramid (J16)
number of faces
15
type
14
name
Elongated Pentagonal Cupola (J20)
number of faces
22

MeshBuilder

usage :

const polyhedron = BABYLON.MeshBuilder.CreatePolyhedron("oct", options, scene); //scene is optional and defaults to the current scene
optionvaluedefault value
option
type
value
(number) polyhedron type in the range [0,14]
default value
0
option
size
value
(number) polyhedron size
default value
1
option
sizeX
value
(number) X polyhedron size, overwrites the size property
default value
1
option
sizeY
value
(number) Y polyhedron size, overwrites the size property
default value
1
option
sizeZ
value
(number) Z polyhedron size, overwrites the size property
default value
1
option
custom
value
(polygonObjectReference) a polyhedron object, overwrites the type property
default value
null
option
faceColors
value
(Color4[]) array of Color4, one per face
default value
Color4(1, 1, 1, 1) for each side
option
faceUV
value
(Vector4[]) array of Vector4, one per face
default value
UVs(0, 0, 1, 1) for each side
option
flat
value
(boolean) if false, a polyhedron has a single global face, faceUV and faceColors are ignored
default value
true
option
updatable
value
(boolean) true if the mesh is updatable
default value
false
option
sideOrientation
value
(number) side orientation
default value
DEFAULTSIDE

To understand how to set faceUV or faceColors, please read about Face Colors and Textures for a Box taking into account the right number of faces of your polyhedron, instead of only 6 for a box.

Examples

The full set of 15: Full Set Of 15 Polyhedra Dodecahedron with FaceUVs: Dodecahedron with FaceUVs

Mesh

usage :

const polyhedron = BABYLON.Mesh.CreatePolyhedron("oct", options, scene); //scene is optional and defaults to the current scene

This is the same format as that for MeshBuilder