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 = "",
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 | How the scene background is rendered: solid color, image, shader, or environment map. | Options: None, Color, Image, Environment map, Shader, TSL |
| environmentIntensity | Float | 1 | Multiplier for the contribution of the environment map to lighting and background. |
| clearColor | Color | Color.new(0, 0, 0, 255) | Color used to clear the framebuffer before rendering each frame. |
| shadowType | Enum | PCF Shadow Map | Shadow filtering technique: basic hard shadows, PCF soft shadows, or variance shadow maps (VSM). | Options: Basic Shadow Map, PCF Shadow Map, VSM Shadow Map |