SgBox¶
A simple 3D box (cuboid) mesh used as a basic geometric building block in the scene. Can be scaled, rotated, and textured like any other scene object. Useful for prototyping or constructing simple environments.
Inherits from¶
Usage¶
To use this class, add the following require at the top of your script:
local SgBox = require 'engine/sceneobjects/sgbox'
Reference¶
- class SgBox¶
- module:
- create(options, parent)¶
Create a new box object in the scenegraph. See possible options below.
- Parameters:
options (
table
) – A table of options to fill the parametersparent (
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
-- Options can be omitted. This example shows the defaults, -- only specify the ones you want different. SgBox:create({ active = true, name = "", transform = Transform.new(), layers = {0}, tags = {}, receiveShadow = false, castShadow = false, material = nil, size = Vector3.new(1, 1, 1), segments = Vector3.new(1, 1, 1) })