Spacecraft are defined in SSC catalog files. All SSC definitions are loaded when Celestia first starts up. In other words, you can't define a spacecraft from scratch while Celestia is running.

However, you can define them with "Visible false" so they are invisible when they're loaded. You can change an object's Visible status using a Lua script while Celestia is running. 3D Meshes and their associated surface textures are not loaded until the first time they become visible, which causes Celestia to pause briefly (or not so briefly if they're large and complex).

I created an SLS.ssc file defined below but I cannot Navigation|"Select Object" like I do for the ISS. I know the 3D model works because I substituted it in the ISS.scc and it showed up. I would have added the files if I knew how to attach a file to the forum. Thoughts?

-- Set the required fields boundingRadius and position; note that position is actually a function -- Compute the bounding radius from the amplitudes orbit.boundingRadius = 1000.0

-- The position function will be called whenever Celestia needs the position of the object function orbit:position(tjd) local t = tjd - 2451545.0 local x = posx[vFS] local y = posy[vFS] local z = posz[vFS] return x, y, z end return orbitend

-- prototype for the wobble scripted rotation has default values for-- any parameters that are omitted in the ssc file.wobbleproto ={ Amplitude = 0, Period = 1,}

-- set the period to whatever value was specified in the ssc file; -- slightly confusing because Celestia is case sensitive--period must -- be lowercase, but the field from the ssc file is capitalized. o.period = o.Period

return oend

-- The orientation function. This implementation produces a back and forth-- wobble of Amplitude degrees about the z axis.function wobbleproto:orientation_vFS(tjd) local t = tjd - 2451545.0

Added after 1 hour 7 minutes:I have an update after learning a few things. I learned that I can press ~ to get my errors on the screen. Too Cool.

I noticed that I have errors relating to my lua script not found. I placed the lua script in several files not knowing where to place it. I could not find the plcae in the documentation where it belongs. After disseminating it to several directories, I not get a segmentation fault right away as it was loading sls.scc (my new lua script).

My code in the previous post has not changed. I must have a problem with that code somewhere while loading.

CelX scripts can be anywhere. They must not depend on any external lua files.

The lua files accessed by ScriptedOrbit and ScriptedRotation must be in the subdirectory named celxx which must be in the same directory as the .SSC catalog.

Errors in ScriptedOrbit and ScriptedRotation files usually crash Celestia instead of displaying error messages, so I usually debug their functions in CelX scripts first.

All of the code in a file defining a ScriptedOrbit (or ScriptedRotation) is executed when the ScriptedOrbit (or ScriptedOribit) is first encountered while Celestia is loading the SSC catalog. After that, only the function specified in that ScriptedOrbit (or ScriptedRotation) is called each time Celestia refreshes the screen.

When showing code in a post, it's best to surround it with the BBCode labels [ code] and [ /code] (without the spaces). It'll look like this:

One way to attach a file to a post is1. select the button "Full Editor & Preview" (below the quick-edit pane)2. select the button "Filename:" "Browse" (below the new editing pane)3. find and select the desired zip file (on your local computer)4. Optionally add a "File comment"5. select the button "Filename:" "Add the file"6. select the button "Preview" to see how your message looks, including the attachment7. select the button "Submit" to post the message with the attachment

I need to use my ScriptedPosition Function "vFSPos" to set the SLS position. I can hard code the orbit:position(tjd)'s returned position to a float but I want to make calls like celestia:find("Earth") and use other lua calls to fill the position's values. When I execute Celestia, the '~' command shows that the ssc fails when I try to call celestia:find("Earth")

I think the lua script makes up a dll and I cannot make celestia:xxx calls. Any ideas? My goal is to eventually read a UDP socket to set the spacecraft position.

I want to learn about Celestia frames. Please don't just point me to the Wiki. Gironde wrote that I will have to swap y and z coordinates. Why is this? What coordinate system has huge z values w.r.t. x and y? I thought universal, ecliptic and universal were all the same.

I see where I can get the observer frame but my Lua script crashes when I try to get my scriptedObject frame. Why is this? I could learn more if I can get my scriptedObject frame . Then I could get myframe:getcoordinatesystem().

I have ECEF coordinate and I am trying to get them to show up properly in Celestia.

I haven't used frames much; about all I know for certain is that the coordinate system used internally by Celestia (the one used within ScriptedOrbit Lua routines) is rotated by 90 degrees relative to what you'd expect.

As I mentioned previously, it's usually better to debug Lua functions in CelX scripts rather than trying to debug them in ScriptedOrbits. When malformed Lua functions are used in CelX scripts, they tend to provide error messages (either in popup windows or in the console log) rather than crashing Celestia.