Options
All
  • Public
  • Public/Protected
  • All
Menu

Class BoxBuilder

Class containing static functions to help procedurally build meshes

Hierarchy

  • BoxBuilder

Index

Methods

Methods

Static CreateBoxSearch playground for CreateBox

  • CreateBox(name: string, options: { backUVs?: Vector4; bottomBaseAt?: number; depth?: number; faceColors?: Color4[]; faceUV?: Vector4[]; frontUVs?: Vector4; height?: number; sideOrientation?: number; size?: number; topBaseAt?: number; updatable?: boolean; width?: number; wrap?: boolean }, scene?: Nullable<Scene>): Mesh
  • 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 : https://doc.babylonjs.com/how_to/createbox_per_face_textures_and_colors
    • 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 : https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation
    • The mesh can be set to updatable with the boolean parameter updatable (default false) if its internal geometry is supposed to change once created
    see

    https://doc.babylonjs.com/how_to/set_shapes#box

    Parameters

    • name: string

      defines the name of the mesh

    • options: { backUVs?: Vector4; bottomBaseAt?: number; depth?: number; faceColors?: Color4[]; faceUV?: Vector4[]; frontUVs?: Vector4; height?: number; sideOrientation?: number; size?: number; topBaseAt?: number; updatable?: boolean; width?: number; wrap?: boolean }

      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

Legend

  • Constructor
  • Property
  • Method
  • Property
  • Method
  • Inherited property
  • Inherited method
  • Static property
  • Static method