Page 1 of 1

Can scripting move your view forward in straight line?

Posted: 29.12.2008, 13:26
by fsgregs
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

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

Posted: 29.12.2008, 17:51
by Vincent
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)

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

Posted: 31.12.2008, 02:25
by fsgregs
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

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

Posted: 09.01.2009, 00:02
by Adirondack
Frank,

the move command should look like

Code: Select all

move { duration 10 velocity 10000 }

Duration = sec.
Velocity = km/s

Adirondack