Skip to main content

Scene

Client Server

Methods

number GetTime()

number GetDeltaTime()

Time passed since the last Update() call. Since time between updates is not constant use this to adjust changes such as movement according to the amount of time that has passed

function self:Update()
local speed = 10
local move = Vec3.right
--remember to multiply by delta time, since the time passed between each Update() is not constant
self.transform.pos = self.transform.pos + move * speed * Scene:GetDeltaTime()
end

number GetDebugTime()

integer GetCurrentFrame()

string GetProcessState()

What is currently being processed i.e Start, Update, LateUpdate etc.

Object CreateObject()

Object CreateObject(string, boolean, boolean)

Object CreateObject(string, Object, boolean, boolean)

Object CreateObject(string, Object)

Object CreateObject(Object)

Object CreateObject(string)

Create an object on server or client. The object is not automatically synced to clients unless its set to. For naming we recommend to:

  • Use capital case
  • Use spaces between words
  • If the object only holds a script component, name the object after the script
  • Avoid creating multiple objects with the same name (i.e. by numbering them)
  • If the object somehow belongs to a player include the user ID in the name
local ob = Scene:CreateObject("Player Controller 1")

Also see Scene:MakeNameValid

nil DestroyObject(Object)

Flags the object for deletion. The object will not actually be destroyed until the next frame.

table GetObjectsByName(string)

Object GetObjectByName(string)

Object GetObjectById(string)

table GetRootObjects()

table GetAllObjects()

Object CloneObject(Object)

Object CloneObject(Object, string, boolean)

Object CloneObject(Object, boolean)

Object CloneObject(Object, string)

boolean MoveObject(Object, Object)

boolean MoveObjectAfter(Object, Object)

boolean MoveObjectBefore(Object, Object)

boolean MoveObjectToRoot(Object)

boolean CanMoveObject(Object, Object)

userdata CreateMaterial(string)

Camera GetActiveCamera()

nil SetActiveCamera(Camera)

string AddNewScriptFile(string, Object)

VoxelDB GetVoxelDB(string)

table TraceRay(table)

Vec3 ConvertWcToDc(VoxelRenderer, Vec3)

table ConvertWcToDc(VoxelRenderer, table)

Vec3 ConvertDcToWc(VoxelRenderer, Vec3)

table ConvertDcToWc(VoxelRenderer, table)

boolean IsNameValid(string)

string MakeNameValid(string)

boolean UpdatePrefab(Object)

boolean ResetPrefab(Object)

nil ResetAllPrefabs()

nil UnpackPrefab(Object)

nil RebuildLighting()

LightingUpdate CreateLighting(string, string)

boolean GetProfileScriptsUpdate()

nil SetProfileScriptsUpdate(boolean)

table GetSimpleStats()

table GetVDRStats()

Properties

LightingUpdate lighting

LightingUpdate objectLighting

boolean SimulationPaused

number SimulationSpeed

number Gravity