Executes a function after a delay
.
function to execute after delay.
delay in seconds.
Repeats execution of a function every period
.
Example
const myEllipsoid = Scene.createEllipsoid(0, 0, 0)
Time.scheduleRepeating(() => {
myEllipsoid.speech = `${Time.currentTime.toFixed(2)} seconds have passed.`
}, 1)
function to execute repeatedly.
period in seconds. Default is 0
, causing script to be repeated every frame.
Repeats execution of a function every frame.
Example
//Creates an ellipsoid which says the time that passed since start every frame
const myEllipsoid = Scene.createEllipsoid(0, 0, 0)
Time.scheduleRepeating(() => {
myEllipsoid.speech = `${Time.currentTime.toFixed(2)} seconds have passed.`
})
//Creates a cuboid which moves at a constant speed independent of device performance
const myCuboid = Scene.createCuboid(0, 0, 0)
let speed = 0.1
Time.scheduleRepeating(deltaTime => {
let currentPosition = myCuboid.transform.position
myCuboid.transform.position = currentPosition.add(Vector3.axisX.mult(speed * deltaTime))
})
function to execute every frame.
Manages script execution and engine time.
Time
methods and properties allow you to