API

Creating A Torus

Torus

The created torus (doughnut shape) has its origin at the center of the torus. You can control its diameter and the thickness of its circular body.

MeshBuilder

Example :

import { MeshBuilder } from "@babylonjs/core/Meshes/meshBuilder";
const torus = MeshBuilder.CreateTorus("torus", options, scene);
optionvaluedefault value
diameter
(number) diameter of the torus
1
thickness
(number) thickness of its tube
0.5
tessellation
(number) number of segments along the circle
16
updatable
(boolean) true if the mesh is updatable
false
sideOrientation
(number) side orientation
DEFAULTSIDE
frontUVs
(Vector4) ONLY WHEN sideOrientation:BABYLON.Mesh.DOUBLESIDE set
Vector4(0,0, 1,1)
backUVs
(Vector4) ONLY WHEN sideOrientation:BABYLON.Mesh.DOUBLESIDE set
Vector4(0,0, 1,1)

Examples

Thick: Create a Thick Torus Thin: Create a Thin Torus

Mesh

Usage

import { MeshBuilder } from "@babylonjs/core/Meshes/meshBuilder";
const torus = MeshBuilder.CreateTorus("torus", { diameter, thickness, tessellation, updatable, sideOrientation }, scene);