Circular orbit script

All about writing scripts for Celestia in Lua and the .cel system
Topic author
chris
Site Admin
Posts: 4211
Joined: 28.01.2002
With us: 23 years 1 month
Location: Seattle, Washington, USA

Circular orbit script

Post #1by chris » 20.09.2008, 01:41

Here's a useful little script that makes the viewer orbit the currently center object (that is, whatever it is you're following, sync orbiting, etc.)

http://www.celestiaproject.net/~claurel/celest ... orbit.celx

Place it in your scripts folder, start Celestia, activate it (the title is 'Orbit an object'), then sit back and enjoy. When you've had enough, press ESC to regain keyboard and mouse control of the view. The very last line of the script is this:

orbit_object(30)

30 is the number of seconds it will take for each revolution. If you want a more 'stately' motion, change the value to 60 or even higher. I find this script very useful for demos. I keep two versions--one with a 30 second period, the other 60 seconds--in my scripts folder now.

--Chris

ElChristou
Developer
Posts: 3776
Joined: 04.02.2005
With us: 20 years

Re: Circular orbit script

Post #2by ElChristou » 20.09.2008, 06:37

Nice!
The commented idea of a smooth acceleration in the code is nice; why not implementing it?
Also if I select and object without following, the script won't work. Perhaps a bit of code could automatically turn on the follow attribute?
What about a slightly change of the angle of the orbit during rotation? (this way one would see after a few seconds all the sides of a body?)
Image

Topic author
chris
Site Admin
Posts: 4211
Joined: 28.01.2002
With us: 23 years 1 month
Location: Seattle, Washington, USA

Re: Circular orbit script

Post #3by chris » 20.09.2008, 21:30

ElChristou wrote:Nice!
The commented idea of a smooth acceleration in the code is nice; why not implementing it?
Also if I select and object without following, the script won't work. Perhaps a bit of code could automatically turn on the follow attribute?
What about a slightly change of the angle of the orbit during rotation? (this way one would see after a few seconds all the sides of a body?)

Christophe,

Thanks for the feedback. I uploaded a new version of the script that uses the currently selected object as the center if there's no followed object. I've also enabled the smooth acceleration. I deliberately restricted the orbit to a plane, though a different version of the script with a changing orbit plane could also be useful.

--Chris

Avatar
Cham M
Posts: 4324
Joined: 14.01.2004
Age: 60
With us: 21 years 1 month
Location: Montreal

Re: Circular orbit script

Post #4by Cham » 20.09.2008, 23:47

Chris,

this script would be better if there was also a smooth transition between the initial state of the object on screen, and its final *centered* state on screen. Currently, it's too abrupt.

Also, it would be better if it allows the user to interactively change the orbit orientation (using right-mouse on the object). Currently, it's locked and can't be changed until we cancel the script.
"Well! I've often seen a cat without a grin", thought Alice; "but a grin without a cat! It's the most curious thing I ever saw in all my life!"

ElChristou
Developer
Posts: 3776
Joined: 04.02.2005
With us: 20 years

Re: Circular orbit script

Post #5by ElChristou » 21.09.2008, 07:04

It's me or after a time the script stop by itself?
Last edited by ElChristou on 21.09.2008, 18:36, edited 1 time in total.
Image

ANDREA
Posts: 1543
Joined: 01.06.2002
With us: 22 years 9 months
Location: Rome, ITALY

Re: Circular orbit script

Post #6by ANDREA » 21.09.2008, 09:45

Sorry, probably I'm missing or misunderstanding something here. :oops:
For what I understand, I obtain exactly the same result as follows:
1- in celestia.cfg I set RotateAcceleration 10.0 (this in what I use always, BTW);
2- after clicking e.g. 3 anf G so the Earth is centered on the screen, I push Shift+rightarrow, and I have a smooth orbit around it;
3- moreover I can use right mouse click to orient the object at will. 8)
This script makes a different thing?
Just a doubt, sorry.
Bye

Andrea :D
"Something is always better than nothing!"
HP Omen 15-DC1040nl- Intel® Core i7 9750H, 2.6/4.5 GHz- 1TB PCIe NVMe M.2 SSD+ 1TB SATA 6 SSD- 32GB SDRAM DDR4 2666 MHz- Nvidia GeForce GTX 1660 Ti 6 GB-WIN 11 PRO

ElChristou
Developer
Posts: 3776
Joined: 04.02.2005
With us: 20 years

Re: Circular orbit script

Post #7by ElChristou » 21.09.2008, 18:48

ElChristou wrote:It's me or after a time the script stop by itself?

No one confirm? (it's a problem from my side?)
Image

Topic author
chris
Site Admin
Posts: 4211
Joined: 28.01.2002
With us: 23 years 1 month
Location: Seattle, Washington, USA

Re: Circular orbit script

Post #8by chris » 22.09.2008, 00:07

ANDREA wrote:Sorry, probably I'm missing or misunderstanding something here. :oops:
For what I understand, I obtain exactly the same result as follows:
1- in celestia.cfg I set RotateAcceleration 10.0 (this in what I use always, BTW);
2- after clicking e.g. 3 anf G so the Earth is centered on the screen, I push Shift+rightarrow, and I have a smooth orbit around it;
3- moreover I can use right mouse click to orient the object at will. 8)
This script makes a different thing?
Just a doubt, sorry.
Bye

The script allows you to orbit around an object at rates different than what show get with shift+arrows. And, you don't need to hold any keys down, which is convenient for my usage.

--Chris

ElChristou
Developer
Posts: 3776
Joined: 04.02.2005
With us: 20 years

Re: Circular orbit script

Post #9by ElChristou » 22.09.2008, 06:25

So... why the hell do the script stop on my config?? :(
Image

ANDREA
Posts: 1543
Joined: 01.06.2002
With us: 22 years 9 months
Location: Rome, ITALY

Re: Circular orbit script

Post #10by ANDREA » 22.09.2008, 06:44

chris wrote:
ANDREA wrote:Sorry, probably I'm missing or misunderstanding something here. :oops:
For what I understand, I obtain exactly the same result as follows:
1- in celestia.cfg I set RotateAcceleration 10.0 (this in what I use always, BTW);
2- after clicking e.g. 3 anf G so the Earth is centered on the screen, I push Shift+rightarrow, and I have a smooth orbit around it;
3- moreover I can use right mouse click to orient the object at will. 8)
This script makes a different thing?
Just a doubt, sorry.
Bye
The script allows you to orbit around an object at rates different than what show get with shift+arrows. And, you don't need to hold any keys down, which is convenient for my usage.
--Chris

OK, you are right but, sorry if I'm insisting on this, Chris, this .cel line doesn't obtain the same result? :?

Code: Select all

    orbit {axis [0 1 0]  rate 6.0  duration 60.0}


I feel so, but probably I'm wrong, so just trying to understand.
Bye and thank you.

Andrea :D
"Something is always better than nothing!"
HP Omen 15-DC1040nl- Intel® Core i7 9750H, 2.6/4.5 GHz- 1TB PCIe NVMe M.2 SSD+ 1TB SATA 6 SSD- 32GB SDRAM DDR4 2666 MHz- Nvidia GeForce GTX 1660 Ti 6 GB-WIN 11 PRO

ElChristou
Developer
Posts: 3776
Joined: 04.02.2005
With us: 20 years

Re: Circular orbit script

Post #11by ElChristou » 22.09.2008, 07:14

Andrea, you won't have smooth acceleration with the cel script.
Chris, what about a duration? if set to zero it will be constant, else it will stop smoothly after the time indicated. Possible?
Image

Topic author
chris
Site Admin
Posts: 4211
Joined: 28.01.2002
With us: 23 years 1 month
Location: Seattle, Washington, USA

Re: Circular orbit script

Post #12by chris » 22.09.2008, 16:52

ANDREA wrote:
chris wrote:
ANDREA wrote:Sorry, probably I'm missing or misunderstanding something here. :oops:
For what I understand, I obtain exactly the same result as follows:
1- in celestia.cfg I set RotateAcceleration 10.0 (this in what I use always, BTW);
2- after clicking e.g. 3 anf G so the Earth is centered on the screen, I push Shift+rightarrow, and I have a smooth orbit around it;
3- moreover I can use right mouse click to orient the object at will. 8)
This script makes a different thing?
Just a doubt, sorry.
Bye
The script allows you to orbit around an object at rates different than what show get with shift+arrows. And, you don't need to hold any keys down, which is convenient for my usage.
--Chris

OK, you are right but, sorry if I'm insisting on this, Chris, this .cel line doesn't obtain the same result? :?

Code: Select all

    orbit {axis [0 1 0]  rate 6.0  duration 60.0}


I feel so, but probably I'm wrong, so just trying to understand.
Bye and thank you.

That cel script is very similar to what my script does. I dislike cel so much that I've forgotten what commands are present :)

The celx script offers quite a bit more flexibility though. You can have smooth acceleration, modify the distance to the viewer, etc.

--Chris

ANDREA
Posts: 1543
Joined: 01.06.2002
With us: 22 years 9 months
Location: Rome, ITALY

Re: Circular orbit script

Post #13by ANDREA » 22.09.2008, 17:20

chris wrote:...That cel script is very similar to what my script does. I dislike cel so much that I've forgotten what commands are present :)
The celx script offers quite a bit more flexibility though. You can have smooth acceleration, modify the distance to the viewer, etc. --Chris
Thank you for your sincerity, Chris, very appreciated. :)
Obviously I know that celx has a lot of functions that cel will never allow but, as we say here, "just a little is better than nothing at all", so, being absolutely unable to understand the logics that are beyond the celx language (surely for my fault, but may be that something is due to the various manuals, cryptic for me because IMHO they are addressed to programming involved people, more than to absolute newbies, as they should be). :(
I would be VERY HAPPY to be able to learn how to use celx scripting, but without a simpler manual, starting from the simplest things, it's impossible for me, alas!
On the contrary cel scripting, even with all the missing features, is much simpler and user friendly. 8)
Just my opinion, obviously.
Thank you, Chris.
Bye

Andrea :D
Last edited by ANDREA on 22.09.2008, 17:53, edited 1 time in total.
"Something is always better than nothing!"
HP Omen 15-DC1040nl- Intel® Core i7 9750H, 2.6/4.5 GHz- 1TB PCIe NVMe M.2 SSD+ 1TB SATA 6 SSD- 32GB SDRAM DDR4 2666 MHz- Nvidia GeForce GTX 1660 Ti 6 GB-WIN 11 PRO

Topic author
chris
Site Admin
Posts: 4211
Joined: 28.01.2002
With us: 23 years 1 month
Location: Seattle, Washington, USA

Re: Circular orbit script

Post #14by chris » 22.09.2008, 17:31

ANDREA wrote:
chris wrote:...That cel script is very similar to what my script does. I dislike cel so much that I've forgotten what commands are present :)
The celx script offers quite a bit more flexibility though. You can have smooth acceleration, modify the distance to the viewer, etc. --Chris
Thank you for your sincerity, Chris, very appreciated. :)
Obviously I know that celx has a lot of functions that cel will never allow but, as we say here, "just a little is better than nothing at all", so, being absolutely unable to understand the logics that are beyond the celx language (surely for my fault, but may be that something is due to the various manuals, cryptic for me because IMHO they are addressed to programming involved people, more than to absolute newbies, as they should be). :(
I would be VERY HAPPY to be able to learn how to use celx scripting, but without a simpler manual, starting from the simplest things, it's impossible for me, alas!
On the contrary cel scripting, even with all the missing feattures, is much simpler and user friendly. 8)
Just my opinion, obviously.
Thank you, Chris.
Bye

No disagreement Andrea: we need much better documentation for celx. The reference manual is important, but it's not enough to help a non-programmer learn celx. A standard 'helper library' for celx could also simply some things.

--Chris

ANDREA
Posts: 1543
Joined: 01.06.2002
With us: 22 years 9 months
Location: Rome, ITALY

Re: Circular orbit script

Post #15by ANDREA » 22.09.2008, 17:48

chris wrote:
ANDREA wrote:....may be that something is due to the various manuals, cryptic for me because IMHO they are addressed to programming involved people, more than to absolute newbies, as they should be). :( I would be VERY HAPPY to be able to learn how to use celx scripting, but without a simpler manual, starting from the simplest things, it's impossible for me, alas! On the contrary cel scripting, even with all the missing features, is much simpler and user friendly. 8)
Thank you, Chris. Bye Andrea
No disagreement Andrea: we need much better documentation for celx. The reference manual is important, but it's not enough to help a non-programmer learn celx. A standard 'helper library' for celx could also simply some things.
--Chris
Thank you Chris, I'm happy you agree on this.
Let's hope that in the future a VERY KIND guy will write it. :wink:
Bye

Andrea :D
"Something is always better than nothing!"
HP Omen 15-DC1040nl- Intel® Core i7 9750H, 2.6/4.5 GHz- 1TB PCIe NVMe M.2 SSD+ 1TB SATA 6 SSD- 32GB SDRAM DDR4 2666 MHz- Nvidia GeForce GTX 1660 Ti 6 GB-WIN 11 PRO


Return to “Scripting”