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)) local handler = ActionHandler.new { layouts = { 0 }, actions = { MoveForwardBackward = "Axis", MoveLeftRight = "Axis", MoveUpDown = "Axis", LookLeftRight = "Axis", LookUpDown = "Axis", LookRoll = "Axis", ObjectsMoveUpDown = "Axis" }, mappings = { { layout = 0, binds = { MoveForwardBackward = { "key:w=1.0", "key:s=-1.0" }, MoveLeftRight = { "key:a=-1.0", "key:d=1.0" }, MoveUpDown = { "key:c=1.0", "key:z=-1.0" }, LookLeftRight = { "key:left=-1.0", "key:right=1.0", "mouse:axis:x" }, LookUpDown = { "key:up=-1.0", "key:down=1.0", "mouse:axis:y", }, LookRoll = { "key:e=-1.0", "key:q=1.0", }, ObjectsMoveUpDown = { "key:u=1.0", "key:j=-1.0" } } } } } world:add_resource(handler) 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) local act = world:resource(ActionHandler) ---@type number local move_objs = act:get_axis("ObjectsMoveUpDown") world:view(function (t) if move_objs ~= nil then t:translate(0, move_objs * 0.35 * dt, 0) return t end 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 ]]