Page 1 of 1

How can I slow do the "Go to" speed?

Posted: 30.03.2008, 20:02
by programmerintraining
Is there any way to slow down the travel speed? I travel from outside the Milky Way to the sun so fast I can hardly see it!

Re: How can I slow do the "Go to" speed?

Posted: 30.03.2008, 20:11
by Hungry4info
I think Celestia could certainly use improved velocity measurements and indicators. Setting the "go to" speed, for one, as well as setting a non-"Go to" speed. Perhaps a dialogue box which asks us for a velocity, lets us select units, and after pressing "Okay" or "enter" or whatever, the observer assumes that speed.

Re: How can I slow do the "Go to" speed?

Posted: 31.03.2008, 11:04
by Vincent
This can be done quite simply with a celx script:

Code: Select all

-- Title: Slower Goto command

-- Modify the following value to your specific needs:
duration = 20

function slowGoto()
   sel = celestia:getselection()
   obs = celestia:getobserver()
   obs:follow(sel)
   obs:goto(sel, duration)
end

keyhandlers =
{
   g = slowGoto
}

function handlekey(k)
   handler = keyhandlers[k.char]
   if handler ~= nil then
      handler()
      return true
   else
      return false
   end
end

celestia:registereventhandler("key", handlekey)


Now, as an exercise, you can try making the duration vary according to the distance from the target... :wink:

Re: How can I slow do the "Go to" speed?

Posted: 01.04.2008, 01:06
by buggs_moran
In fact all of the celx commands goto, gotolonglat, gotolocation, gotodistance, gotosurface, center, and centerorbit have a duration component.

Re: How can I slow do the "Go to" speed?

Posted: 04.04.2008, 21:19
by fsgregs
Vincent:

Do we have to enter a value for getselection? If so, what do we enter?

Frank

Re: How can I slow do the "Go to" speed?

Posted: 04.04.2008, 21:22
by Vincent
fsgregs wrote:Do we have to enter a value for getselection? If so, what do we enter?
Frank,

getselection() automatically returns the current selection.
So, users don't have to enter any value. Did you meet any problem
with this script?

Re: How can I slow do the "Go to" speed?

Posted: 04.04.2008, 21:32
by fsgregs
Vincent:

The script worked just fine. In fact, it works so well that I would love to see it active all of the time, whenever I launch Celestia 1.5.0.

To the best of my knowledge, Celestia can only run one celx script at a time. So, if I have the slowgo script active and I want to launch a new script, I guess slowgo.celx stops functioning as soon as the new celx script launches. Is that correct? If so, is there a way to incorporate it into the celestia.cfg file, or somehow keep it active as long as 1.5.0 is running, no matter what other scripts are launched?

Frank

Re: How can I slow do the "Go to" speed?

Posted: 04.04.2008, 21:45
by Vincent
fsgregs wrote:The script worked just fine. In fact, it works so well that I would love to see it active all of the time, whenever I launch Celestia 1.5.0.
Frank,

To do so, you just need to save the following script as start.celx, and set InitScript "start.celx" in celestia.cfg:

Code: Select all

-- Modify the following value to your specific needs:
duration = 20

function slowGoto()
   sel = celestia:getselection()
   obs = celestia:getobserver()
   obs:goto(sel, duration)
end

keyhandlers =
{
   g = slowGoto
}

function handlekey(k)
   handler = keyhandlers[k.char]
   if handler ~= nil then
      handler()
      return true
   else
      return false
   end
end

celestia:registereventhandler("key", handlekey)


function CEL(source)
   local script = celestia:createcelscript(source)
   while script:tick() do
      wait(0)
   end
end


CEL([[
{

# ... Beginning of script

# PASTE YOUR WHOLE STANDARD START SCRIPT HERE

# End of standard script...
}

]])

Re: How can I slow do the "Go to" speed?

Posted: 05.04.2008, 02:14
by fsgregs
Vincent:

ThAT WORKED FINE AGAIN. Thank you. Now, my start.celx script has a configurable value for how fast the go to command is. What a wonderful feature.

I suggest that it is so useful it should be put into celestia.cfg as a variable, or incorporated into Celestia's default start.celx.

:D

Frank

Re: How can I slow do the "Go to" speed?

Posted: 15.04.2008, 19:10
by max.li
Really nice . I tried both possibilities; both work fine.
I think, I will let the start cel as default and select the slow goto by selecting the script.
Thanks a lot, Vincent !