New ScriptedOrbit: Animation path

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: 22 years 10 months
Location: Seattle, Washington, USA

New ScriptedOrbit: Animation path

Post #1by chris » 23.01.2009, 05:54

Attached is a sample add-on that uses a new ScriptedOrbit I've created for simple animation. It allows you to specify any number of position keys in the ssc file. Each key is a string with four numeric values: a time in seconds, and x, y, and z coordinates in kilometers. The Loop parameter a boolean value that determines whether the animation runs just once or repeats for ever. The TimeBase parameter is the Julian date at which the animation begins.

I wrote this ScriptOrbit for two reasons. First of all, it's another example of how to write a ScriptedOrbit. Second, it's useful for simple animations of things like spacecraft components. Unlike SampledTrajectory, no extra file is required it. The ability to repeat the animation is also useful. This ScriptedOrbit is not meant to use large numbers of position keys, as the algorithm it uses to find a pair of keys to interpolate is a simple linear search that will be slow when there are many keys.

--Chris

Code: Select all

"Scripted" "Sol/Eros"
{
    Class "spacecraft"   
    Radius 1

    ScriptedOrbit
    {
        Module "animationlib"
   Function "animationpath"

   TimeBase 2454854.77083
   Loop true

   Pos1 "0 -30 0 0"
   Pos2 "2 11 20.1 30"
   Pos3 "5 11 -20 -20"
   Pos4 "10 -30 0 0"
    }
}

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

Re: New ScriptedOrbit: Animation path

Post #2by selden » 23.01.2009, 17:11

Chris,

animationpath.zp does not contain the module animationlib.lua
Instead it contains the directory scriptorbit and celxx/pathtrajectory.lua

Did you accidentally Zip the wrong directory?
Selden

Topic author
chris
Site Admin
Posts: 4211
Joined: 28.01.2002
With us: 22 years 10 months
Location: Seattle, Washington, USA

Re: New ScriptedOrbit: Animation path

Post #3by chris » 23.01.2009, 20:04

selden wrote:Chris,

animationpath.zp does not contain the module animationlib.lua
Instead it contains the directory scriptorbit and celxx/pathtrajectory.lua

Did you accidentally Zip the wrong directory?

Thanks, Selden--I've now uploaded the correct zip file. Let me know if it's useful to you.

--Chris


Return to “Scripting”