Page 1 of 1

CELX Script trip from earth to the sun

Posted: 23.09.2009, 11:48
by Dandelion
Hello,

I need a celx script that takes me from the earth to the sun at a given speed in real time. I don't need anything fancy just as simple as possible. I thought that this would do the trick

Code: Select all

obs = celestia:getobserver()

sol = celestia:find("Sol")
celestia:select(sol)
obs:center(sol)

obs:setspeed(0.0225)


but for some reason it takes me away from the sun and towards it.

Cheers,
Thomas

Re: CELX Script trip from earth to the sun

Posted: 23.09.2009, 12:26
by Vincent
Thomas,

You may want to try something like:

Code: Select all

obs = celestia:getobserver()

sol = celestia:find("Sol")
celestia:select(sol)
obs:center(sol)
wait(5)

obs:setspeed(0.5)

dist = sol:radius() * 5
while sol:getposition():distanceto(obs:getposition()) > dist do
    wait(0)
end

obs:setspeed(0.0)

Re: CELX Script trip from earth to the sun

Posted: 30.09.2009, 10:53
by Dandelion
Hi Vincent,
thanks for the script its just what I needed!!

Now my next question: After reaching the sun I want to pass by it (no problem here I managed that) and than look back at it. So how can I trigger the keyboard shortcut shift + * (rear view) with in a script?

Greetings,
Thomas