SgTorus

Creates a doughnut-shaped 3D mesh (torus), optionally with inner and outer radius controls. Can be used for abstract geometry, rings, or decorative objects. May support adjustable segment counts for smoother appearance or performance tuning.

Inherits from

Usage

To use this class, add the following require at the top of your script:

local SgTorus = require 'engine/sceneobjects/sgtorus'

Reference

class SgTorus
module:
create(options, parent)

Create a new torus object in the scenegraph.

Parameters:
  • options (table) – A table of options to fill the parameters

  • parent (SceneObject) – The parent scene object to add this to

Returns:

a promise which will resolve to the created object

Return type:

Promise

Usage:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
-- Options can be omitted. This example shows the defaults,
-- only specify the ones you want different.
SgTorus:create({
    active = true,
    name = "",
    transform = Transform.new(),
    layers = {0},
    tags = {},
    receiveShadow = false,
    castShadow = false,
    material = nil,
    radius = 1,
    tube = 0.4,
    radialSegments = 8,
    tubularSegments = 16,
    arc = 360
})

Examples