Page 1 of 5

ScriptedOrbit tutorial

Posted: 10.10.2009, 12:45
by Fenerit
##########################################################################
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

Re: Three Lissajous curves

Posted: 10.10.2009, 13:40
by Cham
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

Re: Three Lissajous curves

Posted: 10.10.2009, 13:45
by Fenerit
Happy MAc no longer have problem. At post in which its malfunction is suggested as Mac bug doesn't happen nothing...

Re: Three Lissajous curves

Posted: 10.10.2009, 13:53
by Cham
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 ?

Re: Three Lissajous curves

Posted: 10.10.2009, 14:00
by Fenerit
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

Re: Three Lissajous curves

Posted: 10.10.2009, 14:04
by Cham
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).

Re: Three Lissajous curves

Posted: 10.10.2009, 14:08
by Fenerit
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:

Re: Three Lissajous curves

Posted: 10.10.2009, 14:48
by Fenerit
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
}

Re: Three Lissajous curves

Posted: 10.10.2009, 14:53
by Fenerit
Martin, the time of your TimeBase coincide and is up?

Re: Three Lissajous curves

Posted: 10.10.2009, 15:04
by Cham
Fenerit wrote:Martin, the time of your TimeBase coincide and is up?

Sorry, I don't understand. Please, elaborate a bit...

Re: Three Lissajous curves

Posted: 10.10.2009, 15:10
by Fenerit
Enceladus geysers are visible after that TimeBase, so I wonder that if only the julian data of your Celestia was before that data.

Re: Three Lissajous curves

Posted: 10.10.2009, 15:29
by Cham
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.

Re: Three Lissajous curves

Posted: 10.10.2009, 15:34
by Fenerit
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.

Re: Three Lissajous curves

Posted: 10.10.2009, 15:58
by Cham
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.

Re: Three Lissajous curves

Posted: 10.10.2009, 16:13
by Fenerit
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:

Re: Three Lissajous curves

Posted: 11.10.2009, 14:37
by Fenerit
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.

Re: Three Lissajous curves

Posted: 11.10.2009, 14:58
by Cham
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.

Re: Three Lissajous curves

Posted: 11.10.2009, 15:04
by Fenerit
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.

Re: Three Lissajous curves

Posted: 11.10.2009, 15:27
by Cham
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

Re: Three Lissajous curves

Posted: 11.10.2009, 16:04
by Fenerit
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.