# Creating A Torus Knot

> Learn how to create a torus knot in Babylon.js.

Source: https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set/torus_knot

## Torus Knot
A torus knot is a continuous shape that twists and turns around the surface of a torus. The number of twists and turns is determined by two winding integers, p and q. The simplest torus knot uses 2 and 3 for p and q. The origin of the created torus knot is at the center of the underlying torus.

## MeshBuilder
Example :
```javascript
const torus = BABYLON.MeshBuilder.CreateTorusKnot("torusKnot", options, scene);
```

option|value|default value
--------|-----|-------------
radius|_(number)_ radius of the torus knot|2
tube|_(number)_ thickness of its tube|0.5
radialSegments|_(number)_ number of radial segments|32
tubularSegments|_(number)_ number of tubular segments|32
p|_(number)_ number of windings|2
q|_(number)_ number of windings|3
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
Simplest: [Playground: Create a Simple Torus Knot](https://playground.babylonjs.com/#SVU8U9#1) - Simple example of creating a simple torus knot. 
Low p and q: [Playground: Create a Torus Knot With Low P And Q](https://playground.babylonjs.com/#SVU8U9#2) - Simple example of creating a simple torus knot with low P And Q.
High p and q: [Playground: Create a Torus Knot With High P And Q](https://playground.babylonjs.com/#SVU8U9#3) - Simple example of creating a simple torus knot with high P And Q.
Breaking the rules - using high non-integer P and q: [Playground: Create a Torus Knot With High non integer P And Q](https://playground.babylonjs.com/#SVU8U9#4) - Simple example of creating a simple torus knot with high non integer P And Q.

## Mesh
```javascript
const knot = BABYLON.MeshBuilder.CreateTorusKnot("knot", {radius, tube, radialSegments, tubularSegments, p, q}, scene);
```
