SgScene
The root node or container for all scene objects. Manages object hierarchy, updates, and global systems like lighting or audio. Typically created and loaded by the engine to represent a level or game world.
Inherits from
Usage
To use this class, add the following require at the top of your script:
Reference
create
Create a new scene 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.
SgScene.create({
active = true,
name = "",
transform = Transform.new(),
layers = {0},
tags = {}
})
Properties
You can access these properties directly on the object or through :get("propertyName") or :set("propertyName", value) methods.
| Property | Type | Default | Description |
|---|---|---|---|
| cameraMode | Enum | Automatic user controllable camera | Camera to render during playback. The main camera is the one with the 'mainCamera' Tag or if only one camera exists, that is the one. Composer setting will render whatever the composition defines. | Options: Automatic user controllable camera, Main camera, Composer |
| backgroundMode | Enum | None | Options: None, Color, Image, Environment map, Shader |
| environmentIntensity | Float | 1 | |
| clearColor | Color | Color.new(0, 0, 0, 255) | |
| shadowType | Enum | PCF Shadow Map | Options: Basic Shadow Map, PCF Shadow Map, VSM Shadow Map |