-- Title: Tour around Solar system objects

function gotoobject(o, t)
    local obs = celestia:getobserver()
    obs:follow(o)
    obs:gotoobject(o, t)
        while (obs:travelling()) do
        wait(0)
    end
end

function visit(o)
    local i, v
    celestia:select(o)
    celestia:flash(o:type() .. " - " .. o:name())
    gotoobject(o, 3)
    wait(0.5)
    local children = o:getchildren()
    for i, v in ipairs(children) do
        visit(v)
    end
end

sol = celestia:find("Sol")
visit(sol)
