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