lyra-engine/examples/testbed/scripts/test.lua

36 lines
782 B
Lua
Raw Normal View History

function on_init()
local cube = world:request_res("assets/cube-texture-embedded.gltf")
print("Loaded textured cube")
local pos = Transform.from_translation(Vec3.new(0, 0, -8.0))
local e = world:spawn(pos, cube)
print("spawned entity " .. tostring(e))
end
--[[ function on_first()
print("Lua's first function was called")
end
function on_pre_update()
print("Lua's pre-update function was called")
end ]]
function on_update()
---@type number
local dt = world:resource(DeltaTime)
world:view(function (t)
t:translate(0, 0.5 * dt, 0)
return t
end, Transform)
end
--[[ function on_post_update()
print("Lua's post-update function was called")
end
function on_last()
print("Lua's last function was called")
end ]]