-- Init function called from K3dEngine during initialization -- Warning -- Don't delete this function -- Function must exist function Init() print("Loading map ./maps/test/camera_map.lua") K3d_LoadMap("./maps/test/camera_map.lua") InitScene() end -- Update function called from K3dEngine during update scene -- Warning -- Don't delete this function -- Function must exist function Update() UpdateScene() if K3d_CheckKeyboardKey("Esc") then -- Load new script and delete this script -- This function must be called as last function in this script -- else engine shut down in next funcion -- because next function doesn`t exist in new script K3d_LoadNewScript("./scripts/main_menu_script.lua") end end -- Delete function called from K3dEngine during delete scene -- Warning -- Don't delete this function -- Function must exist function Delete() print("Delete called") end -- Global variables g_iCamera = -1 -- Init scene function InitScene() g_iCamera = K3d_GetObject("MainCamera", ObjType.iCameraObj)--K3d_GetCamera("MainCamera") print("g_iCamera =", g_iCamera) if g_iCamera == -1 then print("MainCamera doesn`t exists.") return false end end -- Update scene in every frame function UpdateScene() -- Your some scene updates K3d_Print("K3dEngine 0.1") K3d_Print("Testing K3d_GetCamPos, K3d_GetCamDir scripts") -- Get camera position local x,y,z x,y,z = K3d_GetCamPos(g_iCamera) K3d_PrintValue("Camera position X", x) K3d_PrintValue("Camera position Y", y) K3d_PrintValue("Camera position Z", z) -- Get camera direction vector x,y,z = K3d_GetCamDir(g_iCamera) K3d_PrintValue("Camera direction X", x) K3d_PrintValue("Camera direction Y", y) K3d_PrintValue("Camera direction Z", z) end