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

General discussion about Celestia that doesn't fit into other forums.
Topic author
programmerintraining
Posts: 1
Joined: 30.03.2008
With us: 16 years 7 months

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

Post #1by programmerintraining » 30.03.2008, 20:02

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!

Avatar
Hungry4info
Posts: 1133
Joined: 11.09.2005
With us: 19 years 2 months
Location: Indiana, United States

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

Post #2by Hungry4info » 30.03.2008, 20:11

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.
Current Setup:
Windows 7 64 bit. Celestia 1.6.0.
AMD Athlon Processor, 1.6 Ghz, 3 Gb RAM
ATI Radeon HD 3200 Graphics

Vincent
Developer
Posts: 1356
Joined: 07.01.2005
With us: 19 years 10 months
Location: Nancy, France

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

Post #3by Vincent » 31.03.2008, 11:04

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:
Last edited by Vincent on 07.04.2008, 11:26, edited 1 time in total.
@+
Vincent

Celestia Qt4 SVN / Celestia 1.6.1 + Lua Edu Tools v1.2
GeForce 8600 GT 1024MB / AMD Athlon 64 Dual Core / 4Go DDR2 / XP SP3

buggs_moran
Posts: 835
Joined: 27.09.2004
With us: 20 years 1 month
Location: Massachusetts, USA

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

Post #4by buggs_moran » 01.04.2008, 01:06

In fact all of the celx commands goto, gotolonglat, gotolocation, gotodistance, gotosurface, center, and centerorbit have a duration component.
Homebrew:
WinXP Pro SP2
Asus A7N8X-E Deluxe
AMD Athlon XP 3000/333 2.16 GHz
1 GB Crucial RAM
80 GB WD SATA drive
ATI AIW 9600XT 128M

Avatar
fsgregs
Posts: 1307
Joined: 07.10.2002
With us: 22 years 1 month
Location: Manassas, VA

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

Post #5by fsgregs » 04.04.2008, 21:19

Vincent:

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

Frank

Vincent
Developer
Posts: 1356
Joined: 07.01.2005
With us: 19 years 10 months
Location: Nancy, France

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

Post #6by Vincent » 04.04.2008, 21:22

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?
@+
Vincent

Celestia Qt4 SVN / Celestia 1.6.1 + Lua Edu Tools v1.2
GeForce 8600 GT 1024MB / AMD Athlon 64 Dual Core / 4Go DDR2 / XP SP3

Avatar
fsgregs
Posts: 1307
Joined: 07.10.2002
With us: 22 years 1 month
Location: Manassas, VA

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

Post #7by fsgregs » 04.04.2008, 21:32

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

Vincent
Developer
Posts: 1356
Joined: 07.01.2005
With us: 19 years 10 months
Location: Nancy, France

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

Post #8by Vincent » 04.04.2008, 21:45

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...
}

]])
@+
Vincent

Celestia Qt4 SVN / Celestia 1.6.1 + Lua Edu Tools v1.2
GeForce 8600 GT 1024MB / AMD Athlon 64 Dual Core / 4Go DDR2 / XP SP3

Avatar
fsgregs
Posts: 1307
Joined: 07.10.2002
With us: 22 years 1 month
Location: Manassas, VA

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

Post #9by fsgregs » 05.04.2008, 02:14

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

max.li M
Posts: 5
Joined: 25.01.2006
Age: 69
With us: 18 years 10 months

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

Post #10by max.li » 15.04.2008, 19:10

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 !
Max

Celestia 1.61 and ED-Version


Return to “Celestia Users”