SgRing
A flat circular ring shape, defined by inner and outer radii. Commonly used for UI elements, radial indicators, portals, or targeting effects. Lies in a single plane and can be transformed like any mesh.
Inherits from
Usage
To use this class, add the following require at the top of your script:
Reference
create
Create a new ring object in the scenegraph.
Parameters
selfoptions(table): A table of options to fill the parametersparent(SceneObject): The parent scene object to add this to
Returns
Promise: promise which will resolve to the created object
Example
-- Options can be omitted. This example shows the defaults,
-- only specify the ones you want different.
SgRing.create({
active = true,
name = "",
transform = Transform.new(),
layers = {0},
tags = {},
receiveShadow = false,
castShadow = false,
material = nil,
innerRadius = 0.5,
outerRadius = 1,
thetaSegments = 8,
phiSegments = 1,
thetaStart = 0,
thetaLength = 360
})
Properties
You can access these properties directly on the object or through :get("propertyName") or :set("propertyName", value) methods.
| Property | Type | Default | Description |
|---|---|---|---|
| active | Boolean | true | Indicates if the 3D object is currently active or inactive. When set to true, the object is active. |
| static | Boolean | false | A Boolean attribute indicating whether the 3D object is static or not. Static objects can and will never be transformed during runtime. |
| transform | Transform | Transform.new() | Describes the object's transformation attributes including its position, rotation, and scale in the 3D space. |
| layers | Layers | [0] | Defines the layers that the 3D object is part of. Layers are used for managing object interactions and visibility in the scene. |
| tags | Tags | [] | Lists tags associated with the 3D object. Tags are useful for categorizing and searching objects in the scene. |
| receiveShadow | Boolean | false | Determines whether the object can receive shadows from other objects. Set to true if the object should display shadows cast upon it. |
| castShadow | Boolean | false | Controls whether the object casts shadows in the presence of light sources. Set to true to enable shadow casting from this object. |
| rendered | Boolean | true | Indicates if the 3D object is being rendered. |
| innerRadius | Float | 0.5 | |
| outerRadius | Float | 1 | |
| thetaSegments | Integer | 8 | |
| phiSegments | Integer | 1 | |
| thetaStart | Float | 0 | |
| thetaLength | Float | 360 | |
| uVScale | Vector2d | Vector2.new(1, 1) | |
| physicsEnabled | Boolean | false | A Boolean attribute that determines whether physics properties are applied to the object. Disabling it turns off physics calculations. |