Can scripting move your view forward in straight line?

All about writing scripts for Celestia in Lua and the .cel system
Avatar
Topic author
fsgregs
Posts: 1307
Joined: 07.10.2002
With us: 22 years 1 month
Location: Manassas, VA

Can scripting move your view forward in straight line?

Post #1by fsgregs » 29.12.2008, 13:26

Hi all:

I am working on an exciting add-on controlled by a script, and I have been searching for a way to move my view forward in a straight line, much as you might do in Celestia by pressing the [A] key and moving your view independently of any orbits or other objects.

I have not found any script commands that duplicate the [A] key. Maybe I'm just missing them.

Are there any? If so, how would they be used?

Thanks in advance. :)

Frank

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

Re: Can scripting move your view forward in straight line?

Post #2by Vincent » 29.12.2008, 17:51

fsgregs wrote:I have not found any script commands that duplicate the [A] key. Maybe I'm just missing them.
Hi Frank,

You can use the following celx code to set the speed of the observer:

Code: Select all

speed = 1e-4 -- in microlightyears/s
obs = celestia:getobserver()
obs:setspeed(speed)
@+
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
Topic author
fsgregs
Posts: 1307
Joined: 07.10.2002
With us: 22 years 1 month
Location: Manassas, VA

Re: Can scripting move your view forward in straight line?

Post #3by fsgregs » 31.12.2008, 02:25

Thanks, Vincent. I will use your 3 lines when needed in celx scripts to move the view in a particular direction. :)

Is there something similar for use in cel scripts? I see there is a command called "Move". I have not used it and while I read the brief comment about the command on the Scripts cel WIKI, I don't really understand what parameters it would use, or how to use them. It seems like it would allow a script writer to move their view in a particular direction.

If true, could you provide a short descriptive example of what a "Move" command line would look like?

Thank you

Frank

Avatar
Adirondack M
Posts: 528
Joined: 01.03.2004
With us: 20 years 9 months

Re: Can scripting move your view forward in straight line?

Post #4by Adirondack » 09.01.2009, 00:02

Frank,

the move command should look like

Code: Select all

move { duration 10 velocity 10000 }

Duration = sec.
Velocity = km/s

Adirondack
We all live under the same sky, but we do not have the same horizon. (K. Adenauer)
The horizon of some people is a circle with the radius zero - and they call it their point of view. (A. Einstein)


Return to “Scripting”