Function CreatePolyhedron
-
CreatePolyhedron(
name: string,
options?: {
backUVs?: Vector4;
custom?: any;
faceColors?: Color4[];
faceUV?: Vector4[];
flat?: boolean;
frontUVs?: Vector4;
sideOrientation?: number;
size?: number;
sizeX?: number;
sizeY?: number;
sizeZ?: number;
type?: number;
updatable?: boolean;
},
scene?: Nullable<Scene>,
): MeshParameters
- name: string
defines the name of the mesh
- options: {
backUVs?: Vector4;
custom?: any;
faceColors?: Color4[];
faceUV?: Vector4[];
flat?: boolean;
frontUVs?: Vector4;
sideOrientation?: number;
size?: number;
sizeX?: number;
sizeY?: number;
sizeZ?: number;
type?: number;
updatable?: boolean;
} = {}defines the options used to create the mesh
- scene: Nullable<Scene> = null
defines the hosting scene
Returns Mesh
the polyhedron mesh
- name: string
Creates a polyhedron mesh
type(positive integer, max 14, default 0) sets the polyhedron type to build among the 15 embbeded types. Please refer to the type sheet in the tutorial to choose the wanted typesize(positive float, default 1) sets the polygon sizesizeon each dimension bu using the parameterssizeX,sizeYorsizeZ(positive floats, default tosizevalue)custom(polyhedronObject, default null). If you set the parametercustom, this overrides the parametertypepolyhedronObjectis a formatted javascript object. You'll find a full file with pre-set polyhedra here : https://github.com/BabylonJS/Extensions/tree/master/PolyhedronfaceColors(Color4, default(1, 1, 1, 1)) and faceUV (Vector4, default(0, 0, 1, 1))faceUVorfaceColors, please read this by considering the right number of faces of your polyhedron, instead of only 6 for the box : https://doc.babylonjs.com/features/featuresDeepDive/materials/using/texturePerBoxFaceflat(boolean, default true). If set to false, it gives the polyhedron a single global face, so less vertices and shared normals. In this case,faceColorsandfaceUVare ignoredfrontUVsandbackUVs(Vector4). Detail here : https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#side-orientationupdatable(default false) if its internal geometry is supposed to change once created