Skip to main content

Scene3D

The 3D scene interface

scene = Scene3D.new()
scene.add_model(Scene3D.axes { length = 1000 })
scene.control = true

Properties

last

Scene3D.last: Scene3DRef

Get the last created scene instance.

This is useful when using the in-game lua console for debugging.

Functions

new

Scene3D.new() → Scene3DRef

Creates a new scene

model

Scene3D.model(
optionstable--

settings

) → Scene3DModelRef

Create a new model

Current supported file formats:

  • .obj/.mtl (specify the path to the .obj file)

Options

Name Type Default Description
path string - model file path

axes

Scene3D.axes(
optionstable--

settings

) → Scene3DModelRef

Create new axes

Useful for debugging purposes.

Options

Name Type Default Description
length number 5000 axes line length

triangle

Scene3D.triangle(
optionstable--

settings

) → Scene3DModelRef

Create a new triangle face

Options

Name Type Default Description
vertices table - list of vertices (3x Vec3)
colors table - list of colors (3x Vec3)
back bool true add the back side face

quad

Scene3D.quad(
optionstable--

settings

) → Scene3DModelRef

Create a new quad face

Options

Name Type Default Description
vertices table - list of vertices (4x Vec3)
colors table - list of colors (4x Vec3)
back bool true add the back side face
Show raw api
{
    "functions": [
        {
            "name": "new",
            "desc": "Creates a new scene",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Scene3DRef"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 18,
                "path": "../../res/data/script/lib/system/scene3d.lua"
            }
        },
        {
            "name": "model",
            "desc": "Create a new model\n\nCurrent supported file formats:\n- .obj/.mtl (specify the path to the .obj file)\n\n### Options\n| Name            | Type        | Default | Description                    |\n|-----------------|-------------|---------|--------------------------------|\n| path            | string      |       - | model file path                |",
            "params": [
                {
                    "name": "options",
                    "desc": "settings",
                    "lua_type": "table"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Scene3DModelRef"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 44,
                "path": "../../res/data/script/lib/system/scene3d.lua"
            }
        },
        {
            "name": "axes",
            "desc": "Create new axes\n\nUseful for debugging purposes.\n\n### Options\n| Name            | Type        | Default | Description                    |\n|-----------------|-------------|---------|--------------------------------|\n| length          | number      |    5000 | axes line length               |",
            "params": [
                {
                    "name": "options",
                    "desc": "settings",
                    "lua_type": "table"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Scene3DModelRef"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 61,
                "path": "../../res/data/script/lib/system/scene3d.lua"
            }
        },
        {
            "name": "triangle",
            "desc": "Create a new triangle face\n\n### Options\n| Name            | Type        | Default | Description                    |\n|-----------------|-------------|---------|--------------------------------|\n| vertices        | table       |       - | list of vertices (3x Vec3)     |\n| colors          | table       |       - | list of colors (3x Vec3)       |\n| back            | bool        |    true | add the back side face         |",
            "params": [
                {
                    "name": "options",
                    "desc": "settings",
                    "lua_type": "table"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Scene3DModelRef"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 78,
                "path": "../../res/data/script/lib/system/scene3d.lua"
            }
        },
        {
            "name": "quad",
            "desc": "Create a new quad face\n\n### Options\n| Name            | Type        | Default | Description                    |\n|-----------------|-------------|---------|--------------------------------|\n| vertices        | table       |       - | list of vertices (4x Vec3)     |\n| colors          | table       |       - | list of colors (4x Vec3)       |\n| back            | bool        |    true | add the back side face         |",
            "params": [
                {
                    "name": "options",
                    "desc": "settings",
                    "lua_type": "table"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Scene3DModelRef"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 95,
                "path": "../../res/data/script/lib/system/scene3d.lua"
            }
        }
    ],
    "properties": [
        {
            "name": "last",
            "desc": "Get the last created scene instance.\n\nThis is useful when using the in-game lua console for debugging.",
            "lua_type": "Scene3DRef",
            "source": {
                "line": 29,
                "path": "../../res/data/script/lib/system/scene3d.lua"
            }
        }
    ],
    "types": [],
    "name": "Scene3D",
    "desc": "The 3D scene interface\n\n```lua\nscene = Scene3D.new()\nscene.add_model(Scene3D.axes { length = 1000 })\nscene.control = true\n```",
    "source": {
        "line": 11,
        "path": "../../res/data/script/lib/system/scene3d.lua"
    }
}