29 lines
733 B
Lua
29 lines
733 B
Lua
io.write("script loaded successfully\n")
|
|
|
|
local time_elapsed = 0
|
|
|
|
function Start(trans)
|
|
io.write("lua: Start\n")
|
|
end
|
|
|
|
function Update()
|
|
time_elapsed = time_elapsed + Time:DeltaTime()
|
|
local x = math.sin(time_elapsed * 2) * 2
|
|
local z = math.cos(time_elapsed * 2) * 2
|
|
|
|
local transform = Parent:GetTransform()
|
|
transform.position = vec3:new(x, 1.0, z - 7.0)
|
|
local light = Parent:GetPointLight()
|
|
|
|
local r = 0.5 * (1 + math.sin(time_elapsed * 2.5) * 1.1)
|
|
local g = 0.5 * (1 + math.cos(time_elapsed * 1.5) * 1.2)
|
|
local b = 0.5 * (1 + math.sin(time_elapsed * 3.5) * 1.3)
|
|
r = 1.0
|
|
g = 1.0
|
|
b = 1.0
|
|
light.color = vec3:new(r, g, b)
|
|
end
|
|
|
|
-- Todo: faire bouger le cube
|
|
-- Get inputs to script
|