ScriptedOrbit tutorial

All tutorials about Celestia go in here. For Celestia itself, add-ons, textures, scripting, etc.
Avatar
Topic author
Fenerit M
Posts: 1880
Joined: 26.03.2007
Age: 17
With us: 17 years 8 months
Location: Thyrrenian sea

ScriptedOrbit tutorial

Post #1by Fenerit » 10.10.2009, 12:45

##########################################################################
As start is required to read here:

http://en.wikibooks.org/wiki/Celestia/Trajectories#SampledOrbit

then this thread.
##########################################################################

Image

On plane XY white ball accomplish lemniscate motion, cyan the circle and yellow parabola

http://marauder.webng.com/files/lissajous_curve.zip
Last edited by Fenerit on 11.10.2009, 19:35, edited 2 times in total.
Never at rest.
Massimo

Avatar
Cham M
Posts: 4324
Joined: 14.01.2004
Age: 60
With us: 20 years 10 months
Location: Montreal

Re: Three Lissajous curves

Post #2by Cham » 10.10.2009, 13:40

Hey Fenerit ! This method is extremely interesting ! It gives me a LOT of new ideas ! :D

With the objects set to invisible by default and a toggle CELX switch, we could show lots of new things from within Celestia, using this scripted orbit method. I'll have to do some experiments ...

I guess I'll hit the limitations again ... :x
"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!"

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

Re: Three Lissajous curves

Post #3by Fenerit » 10.10.2009, 13:45

Happy MAc no longer have problem. At post in which its malfunction is suggested as Mac bug doesn't happen nothing...
Never at rest.
Massimo

Avatar
Cham M
Posts: 4324
Joined: 14.01.2004
Age: 60
With us: 20 years 10 months
Location: Montreal

Re: Three Lissajous curves

Post #4by Cham » 10.10.2009, 13:53

Fenerit wrote:Happy MAc no longer have problem. At post in which its malfunction is suggested as Mac bug doesn't happen nothing...

Sorry, I really don't understand what you said here. Could you elaborate ?
"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!"

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

Re: Three Lissajous curves

Post #5by Fenerit » 10.10.2009, 14:00

Well, my Enceladus geysers were founds not working by MAC users, so was post by Ricardo in Celestia Bugs as advertisement. Now, perhaps, I, didn't understood: does the ScriptedOrbit is now working on MAC?

EDIT LATER:
My mistake: ScriptedOrbit not work and ScriptedRotation yes? :cry:

EDIT EDIT LATER:
Sorry, today I'm bit outofcontrol
Last edited by Fenerit on 10.10.2009, 14:06, edited 1 time in total.
Never at rest.
Massimo

Avatar
Cham M
Posts: 4324
Joined: 14.01.2004
Age: 60
With us: 20 years 10 months
Location: Montreal

Re: Three Lissajous curves

Post #6by Cham » 10.10.2009, 14:04

Fenerit wrote:does the ScriptedOrbit is now working on MAC?

Well, as far as I can tell, the lissajou addon above is working on my Mac (while your volcanoes addon isn't).
"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!"

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

Re: Three Lissajous curves

Post #7by Fenerit » 10.10.2009, 14:08

Cham wrote:
Fenerit wrote:does the ScriptedOrbit is now working on MAC?

Well, as far as I can tell, the lissajou addon above is working on my Mac (while your volcanoes addon isn't).

AHHHHH... Is this my out of control!!! WHY? are both ScriptedOrbit! :twisted:
Never at rest.
Massimo

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

Re: Three Lissajous curves

Post #8by Fenerit » 10.10.2009, 14:48

The main differences amongst statement blocks based upon different modules are below:

enceladus_geysers:
ScriptedOrbit
{
Module "animationlib_eg"
Function "animationpath_eg"
TimeBase 2454854.77083
Loop true
Pos1 "0 0 0 0"
Pos2 "0 0 0 25"
Pos3 "25 -0.11 -0.12 -0.13"
Pos4 "51 0 0 0"
}


lissajous_curves:
ScriptedOrbit
{
Module "lissajous_1"
Function "lissajous_1"

PeriodX 0.00025
PeriodY 0.0005
PeriodZ 0.00025
PhaseX 0.25
PhaseY 0.5
PhaseZ 0.0
AmplitudeX 25
AmplitudeY 35
AmplitudeZ 0.0
}
Never at rest.
Massimo

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

Re: Three Lissajous curves

Post #9by Fenerit » 10.10.2009, 14:53

Martin, the time of your TimeBase coincide and is up?
Never at rest.
Massimo

Avatar
Cham M
Posts: 4324
Joined: 14.01.2004
Age: 60
With us: 20 years 10 months
Location: Montreal

Re: Three Lissajous curves

Post #10by Cham » 10.10.2009, 15:04

Fenerit wrote:Martin, the time of your TimeBase coincide and is up?

Sorry, I don't understand. Please, elaborate a bit...
"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!"

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

Re: Three Lissajous curves

Post #11by Fenerit » 10.10.2009, 15:10

Enceladus geysers are visible after that TimeBase, so I wonder that if only the julian data of your Celestia was before that data.
Never at rest.
Massimo

Avatar
Cham M
Posts: 4324
Joined: 14.01.2004
Age: 60
With us: 20 years 10 months
Location: Montreal

Re: Three Lissajous curves

Post #12by Cham » 10.10.2009, 15:29

I just re-tested your volcanoes addon. Well, after time 2454854.77083, it doesn't work at all.

But why this date ? The volcanoes should be ON at any time.
"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!"

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

Re: Three Lissajous curves

Post #13by Fenerit » 10.10.2009, 15:34

Cham wrote:I just re-tested your volcanoes addon. Well, after time 2454854.77083, it doesn't work at all.

But why this date ? The volcanoes should be ON at any time.

In the first version there was an error that was updated. Try to download again (is updated) and whether also this time doesn't work, well... then, I do not know why.
Never at rest.
Massimo

Avatar
Cham M
Posts: 4324
Joined: 14.01.2004
Age: 60
With us: 20 years 10 months
Location: Montreal

Re: Three Lissajous curves

Post #14by Cham » 10.10.2009, 15:58

Fenerit wrote:In the first version there was an error that was updated. Try to download again (is updated) and whether also this time doesn't work, well... then, I do not know why.

Nope, it doesn't work at all.
"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!"

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

Re: Three Lissajous curves

Post #15by Fenerit » 10.10.2009, 16:13

Try to save again the ssc's files with your own editor. :roll: I do not have further ideas. :| Anyhow, I'm happy at least the curves works, because an orbital object emitting particles ( as you can see I can't wait for the particle engines), is what that there want for a binary sistems stars+black holes. :blue:
Never at rest.
Massimo

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

Re: Three Lissajous curves

Post #16by Fenerit » 11.10.2009, 14:37

These two curves could be useful for Celestia Sci-fi users. They simulate a motion saw often in the Sci-fi movies: the dock bay approach. Usually a spacecraft escape from iperspace at high velocity for then accomplish a slowly approach to the bay. Or, it lift off the bay with slow velocity for then jump into iperspace.

Paste this code in the scriptorbit.ssc:

Code: Select all

"Scifi_docks X" "Sol/Eros"
{

   Class "spacecraft"
    Radius 1

   Color [ 1 0 1 ]

   OrbitFrame { BodyFixed { Center "Sol/Eros" } }
    BodyFrame { BodyFixed { Center "Sol/Eros" } }
   
   ScriptedOrbit
    {
        Module "scifi_docks"
        Function "scifi_docks"

        PeriodX       0.000025      
        PeriodY       0.000025      
        PeriodZ       0.000025
        PhaseX          0.25      
        PhaseY          0.25         
        PhaseZ          0.0         
        AmplitudeX       25         
        AmplitudeY       25         
        AmplitudeZ       0.0         
    }

   
}


Then paste the text below in a editor and save it as scifi_docks.lua module in the ../celxx/ dir:

Code: Select all

function scifi_docks(t)
   -- Create a new table
   local orbit = {};

   -- Save the parameter list
   orbit.params = t;

   -- Set the required fields boundingRadius and position; note that position is actually a function

   -- Compute the bounding radius from the amplitudes
   orbit.boundingRadius =
       math.sqrt(t.AmplitudeX * t.AmplitudeX +
                 t.AmplitudeY * t.AmplitudeY +
                 t.AmplitudeZ * t.AmplitudeZ)

   -- The position function will be called whenever Celestia needs the position of the object
   function orbit:position(tjd)
       local t = tjd - 2451545.0
       local pi2 = math.pi * 2;
      
   -- Bay approach --

      local x = self.params.AmplitudeX * math.exp (1 / math.tan((t / self.params.PeriodX - self.params.PhaseX)))
       local y = self.params.AmplitudeY * math.exp (1 / math.tan((t / self.params.PeriodY - self.params.PhaseY)))
       local z = self.params.AmplitudeZ * math.exp (1 / math.tan((t / self.params.PeriodZ - self.params.PhaseZ)))

   -- Bay escape -- comment the formers and uncomment the follows --

--     local x = self.params.AmplitudeX * math.exp (math.tan((t / self.params.PeriodX + self.params.PhaseX)))
--     local y = self.params.AmplitudeY * math.exp (math.tan((t / self.params.PeriodY + self.params.PhaseY)))
--     local z = self.params.AmplitudeZ * math.exp (math.tan((t / self.params.PeriodZ + self.params.PhaseZ)))

       return x, y, z
    end

    return orbit
end


Goto Eros. Being on the XY plane, for the moment try to incline a bit the cameraview to see the "depth" of the effect.
Last edited by Fenerit on 11.10.2009, 15:04, edited 1 time in total.
Never at rest.
Massimo

Avatar
Cham M
Posts: 4324
Joined: 14.01.2004
Age: 60
With us: 20 years 10 months
Location: Montreal

Re: Three Lissajous curves

Post #17by Cham » 11.10.2009, 14:58

This is working, but there's a two steps discontinuity jump at some stage which is really annoying. The pink ball is approaching from infinity, then reappears at another location before finally entering Eros. I know the motion is periodic, but there's an error in the trajectory.
"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!"

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

Re: Three Lissajous curves

Post #18by Fenerit » 11.10.2009, 15:04

Cham wrote:This is working, but there's a two steps discontinuity jump at some stage which is really annoying. The pink ball is approaching from infinity, then reappears at another location before finally entering Eros. I know the motion is periodic, but there's an error in the trajectory.

Yes, indeed. PhaseY should be = to PhaseX. I've corrected the code now.
Never at rest.
Massimo

Avatar
Cham M
Posts: 4324
Joined: 14.01.2004
Age: 60
With us: 20 years 10 months
Location: Montreal

Re: Three Lissajous curves

Post #19by Cham » 11.10.2009, 15:27

No, there's still a mistake (discontinuity jump in the motion). Just follow the ball and watch Eros approaching :

cel://PhaseLock/Sol:Eros:Scifi_docks%20 ... rc=0&ver=3
"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!"

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

Re: Three Lissajous curves

Post #20by Fenerit » 11.10.2009, 16:04

Sorry, Martin there must be an incomprehension: I do not see jumps in the motion. Below there is a video made at 10x time.

http://marauder.webng.com/files/docks.avi 320x240 Xvid, 479kb

When Eros is toggled with ALT+rightarrow is seen as the motion is a spiral. Whether for "jump in the motion" you intend the jump once the ball is inside Eros to out, this is willingly introduced because the motion has been accomplished, the spaceship is in the dock. That motion must be consider as a "fragment" a "scene" of an action. The inverse motion (from the bay to hyperspace) is due to the furthers equations. Both motions are not close orbit as the former three.
Never at rest.
Massimo


Return to “Tutorials”