Class containing static functions to help procedurally build meshes


  • TubeBuilder




Static CreateTube

Find examples in Playground
  • Creates a tube mesh. The tube is a parametric shape. It has no predefined shape. Its final shape will depend on the input parameters

    • The parameter path is a required array of successive Vector3. It is the curve used as the axis of the tube
    • The parameter radius (positive float, default 1) sets the tube radius size
    • The parameter tessellation (positive float, default 64) is the number of sides on the tubular surface
    • The parameter radiusFunction (javascript function, default null) is a vanilla javascript function. If it is not null, it overwrittes the parameter radius
    • This function is called on each point of the tube path and is passed the index i of the i-th point and the distance of this point from the first point of the path. It must return a radius value (positive float)
    • The parameter arc (positive float, maximum 1, default 1) is the ratio to apply to the tube circumference : 2 x PI x arc
    • The parameter cap sets the way the extruded shape is capped. Possible values : BABYLON.Mesh.NO_CAP (default), BABYLON.Mesh.CAP_START, BABYLON.Mesh.CAP_END, BABYLON.Mesh.CAP_ALL
    • The optional parameter instance is an instance of an existing Tube object to be updated with the passed pathArray parameter :
    • 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 optional parameter invertUV (boolean, default false) swaps in the geometry the U and V coordinates to apply a texture
    • 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 arc?: number
      • Optional backUVs?: Vector4
      • Optional cap?: number
      • Optional frontUVs?: Vector4
      • Optional instance?: Mesh
      • Optional invertUV?: boolean
      • path: Vector3[]
      • Optional radius?: number
      • Optional radiusFunction?: function
          • (i: number, distance: number): number
          • Parameters

            • i: number
            • distance: number

            Returns number

      • Optional sideOrientation?: number
      • Optional tessellation?: number
      • Optional updatable?: boolean
    • Optional scene: Nullable<Scene>

      defines the hosting scene

    Returns Mesh

    the tube mesh

Generated using TypeDoc