scripting a star

All about writing scripts for Celestia in Lua and the .cel system
Topic author
fungun
Posts: 315
Joined: 30.07.2007
Age: 63
With us: 17 years 3 months
Location: Iowa, USA

scripting a star

Post #1by fungun » 22.04.2010, 21:11

Can you move a star by a script?
I am trying to make a Photon Torpedo. I cannot make it bright, semi-transparent, and fuzzy all at the same time.
I have already tried to do it all in a 3ds mesh converted to cmod. I have also tried to give my mesh an atmosphere, that turned out horrible. :roll:
So I made my mesh into a star using a stc file, but it has to move from one ship to another.
Any other ideas would be greatly appreciated.

Thanks,
Tim

Avatar
selden
Developer
Posts: 10192
Joined: 04.09.2002
With us: 22 years 2 months
Location: NY, USA

Re: scripting a star

Post #2by selden » 23.04.2010, 15:59

Sorry, Star orbits can only be elliptical, not scripted.

You might try using CMOD sprites.


p.s. some other options to try would be
Emissive true
to make the object bright

and
Atmosphere {...}
to provide a translucent, fuzzy region surrounding it.
Selden

Topic author
fungun
Posts: 315
Joined: 30.07.2007
Age: 63
With us: 17 years 3 months
Location: Iowa, USA

Re: scripting a star

Post #3by fungun » 23.04.2010, 21:44

This is what I have so far.
Is this what you meant?
Not sure about using sprites. Never done anything with them before.
Thanks,
Tim

http://www.youtube.com/watch?v=asxZHZTpf3k

Avatar
selden
Developer
Posts: 10192
Joined: 04.09.2002
With us: 22 years 2 months
Location: NY, USA

Re: scripting a star

Post #4by selden » 23.04.2010, 22:16

That looks reasonably good to me!
Selden

Avatar
Fenerit M
Posts: 1880
Joined: 26.03.2007
Age: 17
With us: 17 years 7 months
Location: Thyrrenian sea

Re: scripting a star

Post #5by Fenerit » 23.04.2010, 23:16

fungun wrote:Can you move a star by a script?
I am trying to make a Photon Torpedo. I cannot make it bright, semi-transparent, and fuzzy all at the same time.
I have already tried to do it all in a 3ds mesh converted to cmod. I have also tried to give my mesh an atmosphere, that turned out horrible. :roll:
So I made my mesh into a star using a stc file, but it has to move from one ship to another.
Any other ideas would be greatly appreciated.

Thanks,
Tim

For moving objects, take a look here:
http://www.shatters.net/forum/viewtopic.php?f=21&t=14419

First try to script you 3d model in order to accomplish the due movement, then the eye-candy.
Never at rest.
Massimo

VikingTechJPL
Posts: 105
Joined: 04.03.2010
With us: 14 years 8 months

Re: scripting a star

Post #6by VikingTechJPL » 24.04.2010, 03:38

Tim,

Here's a "quick and dirty" method that may help get you started or at least give you some other ideas.

The photon torpedo (smaller star) is actually a star circling a barycenter, so it actually moves between the 2 ships (the larger stars) only once each orbit in CELESTIA. Still, if you save (as cel:urls) its motion between the stars several different times (and from several different angles), you can call them sequentially from your script and produce the effect of many torpedo shots.

Basically, in an stc file, I've created two fixed stars that are near each other and 500 light years from Earth. You'll see their coordinates in the stc files. You would substitute your ships in these locations. Then I created a star moving around a barycenter located at the Earth and in the same plane and at the same distance as the two fixed stars. So on Jan 1, 2000 the small star starts moving from FixedStar1 to FixedStar2 because everything in CELESTIA is geared to the J2000 epoch. As I said, you can change your camera to look at this from any angle and any distance. Because the radius of the small star's (photon torpedo's) orbit is so large, it looks like it's moving in a straight line.

If you're making a movie instead of a script, you can record many little clips from a bunch of different angles and then stitch them together. If you want FixedStar2 to return fire, just run time backwards after the small star has reached it. The demo AVI video shows the photon torpedo (smaller star) bouncing back and forth because I just kept reversing time. The included AVI's very rough, only meant to show that motion is possible.

You'll need to make sure that all of your distances and sizes are consistent, because the units for stars and satellites are not expressed the same in CELESTIA (assuming, that is, that your models are satellite objects). CELESTIA's source code has all of the constants and multiples you'll need.

Not knowing what version of CELESTIA you're using, I've included an stc for both for 1.4.1 and 1.6.0. Each also contains a "commented out" cel:url that you can put in a word processor and use after you're installed the stc files in your extras folder and restarted CELESTIA.

Let me know how it works out. I hope it helps.

Gary
1.6.1, Dell Studio XPS, AMD 2.7 GHz, 8 GB RAM, Win 7 64-bit, ATI Radeon HD 5670
1.6.0, Dell Inspiron 1720, Intel Core Duo 2 Ghz, 3 GB RAM, Win Vista, NVIDIA GeForce 8600M G/GT
1.4.1, Dell Dimension 4700, Pent-4 2.8 GHz, 512 MB RAM, Win XP SP2, Radeon X300

Avatar
Fenerit M
Posts: 1880
Joined: 26.03.2007
Age: 17
With us: 17 years 7 months
Location: Thyrrenian sea

Re: scripting a star

Post #7by Fenerit » 24.04.2010, 11:42

For a rotated point sprites object that could resemble aphoton torpedoes look here:
http://www.shatters.net/forum/viewtopic.php?f=11&t=14066

Try to lower the radius and to make the texture more "striking lights". Such model do the rotation only, the ScriptOrbit could make it move in straight line...
Never at rest.
Massimo

Topic author
fungun
Posts: 315
Joined: 30.07.2007
Age: 63
With us: 17 years 3 months
Location: Iowa, USA

Re: scripting a star

Post #8by fungun » 24.04.2010, 19:58

Thank you guys very much. :D
Will try both and see what I come up with.

Tim


Return to “Scripting”