local invref = {} local function hud_text(text) -- utility local array = {name = "vertical"} for i = 1, #text do table.insert(array, { name = "label", text = text[i] }) end return array end local function dump_vec(vec) -- utility return vec["x"] .. ":" .. vec["y"] .. ":" .. vec["z"] end function checkblock(dtime) if not camera then camera = minetest.camera end if not camera then return end local player = minetest.localplayer local cam_v = camera:get_look_dir() local cam_p = camera:get_pos() local vec_n = { x = cam_p["x"] + (cam_v["x"] * 6), y = cam_p["y"] + (cam_v["y"] * 6), z = cam_p["z"] + (cam_v["z"] * 6) } -- makes new vector for raycast target local raycast = minetest.raycast(cam_p, vec_n, false) local node = raycast:next() local node_p = { x = 0, y = 0, z = 0 } if node then node_p = node["under"] end local ref = ui.draw(hud_text({ -- asks ui lib to render this frame, with debug info "Cam pos " .. dump_vec(cam_p), "New pos " .. dump_vec(vec_n), "Cam ang " .. dump_vec(cam_v), "Node " .. dump_vec(node_p) }), 200, 200, invref) invref = ref end minetest.register_globalstep(checkblock)