Torus Knot shape is a complex shape that is useful for testing materials. We’d recommend trying it in the GUI-mode first, before scripting. It adds some new properties, compared to simple torus:
- Size - the main radius of the torus, defines its size
- Amplitude - the secondary radius of the torus, defines the amplitude
- Thickness - the third radius of the torus, defines the thickness
- Turns #1, Turns #2 - defines the number of turns of the knot
- Segments - the number of segments along the torus. Set to 3 to get a triangle.
- Sides - the number of segments across the torus, defines the shape of crossection.
Basically, the larger numbers you use for Segments and Sides, the smoother shape you get.
Here is a sample script that creates a torus knot object:
var m = scene.root.addMesh("torus", "generator.simple.TorusKnot"); var g = m.generator; g.size = 10; g.amplitude = 5; g.thickness = 3; g.turns1 = 2; g.turns2 = 3; g.segments = 256; g.sides = 32;