Class containing static functions to help procedurally build meshes


  • BoxBuilder




Static CreateBox

Find examples in Playground
  • Creates a box mesh

    • The parameter size sets the size (float) of each box side (default 1)
    • You can set some different box dimensions by using the parameters width, height and depth (all by default have the same value of size)
    • You can set different colors and different images to each box side by using the parameters faceColors (an array of 6 Color3 elements) and faceUV (an array of 6 Vector4 elements)
    • Please read this tutorial :
    • You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
    • If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters frontUVs and backUVs (Vector4). Detail here :
    • The mesh can be set to updatable with the boolean parameter updatable (default false) if its internal geometry is supposed to change once created


    • name: string

      defines the name of the mesh

    • options: object

      defines the options used to create the mesh

      • Optional backUVs?: Vector4
      • Optional bottomBaseAt?: number
      • Optional depth?: number
      • Optional faceColors?: Color4[]
      • Optional faceUV?: Vector4[]
      • Optional frontUVs?: Vector4
      • Optional height?: number
      • Optional sideOrientation?: number
      • Optional size?: number
      • Optional topBaseAt?: number
      • Optional updatable?: boolean
      • Optional width?: number
      • Optional wrap?: boolean
    • Optional scene: Nullable<Scene>

      defines the hosting scene

    Returns Mesh

    the box mesh

Generated using TypeDoc