• Polycarbon Games

Unity 3D | How To: Program the Torus

Updated: Jun 12

The most common way of seeing a torus is to compare it to a donut. A torus a bunch of thinly sliced circles placed around a center to look like a donut. The torus (plural tori) is defined by Wikipedia as a surface of revolution generated by revolving a circle in three-dimensional space about an axis that is coplanar with the circle. In other words, it is a collection of circles around a center point whose axis is perpendicular to the center of the circle.

The torus shape is found in atoms, cells, seeds, flowers, trees, animals, humans, hurricanes, planets, suns, galaxies and even the cosmos as a whole. In addition to its relevance to the universe, it’s just cool! I’ve exposed some parameters that allow you to incorporate this cool shape into your games and media. You can control the colors along the circles’ path and you can control the speed of the circles rotation for some interesting effects:

Changing the Rotation Speed

1. Open the inspector

2. Change the speed parameter

Changing the color of the Torus

The Torus is a collection of lines in the shape of a circle, you can control all of the lines’ color through the color gradient provided by Unity. This will draw each line starting with the gradient’s start-color and change its gradient according to the colors defined by its markers. *Gradient Documentation https://docs.unity3d.com/ScriptReference/Gradient.html

1. Open the inspector

2. Select the gradient

3. Select the Marker

4. Select the desired color

5. Select the alpha marker and change the value

The 3D Maker Tools is a must have for any interested in visualization, sacred geometry visualizations or going to school or for game design. For you professionals and hobbyist, stay tuned in for more tutorials and progress of our work in game design.