How to use GoTo in Cel without delay?

All about writing scripts for Celestia in Lua and the .cel system
Topic author
rthorvald
Posts: 1223
Joined: 20.10.2003
With us: 21 years 1 month
Location: Norway

How to use GoTo in Cel without delay?

Post #1by rthorvald » 19.07.2007, 19:56

Still a novice here, i have some challenges:

Look at this:
goto { time 1 distance 4 }

... The camera will slowly accelerate to some speed and then continue cruising until it reaches the target.

Is it possible to have full speed at once? That is, no slow startup, just 100% top speed instantly...

Also, a different problem:
Is it possible to use GOTO and Orbit simultaneously, so that the camera orbits some point WHILE moving towards it?

Thanks for any input,
- rthorvald
Image

Avatar
LordFerret M
Posts: 737
Joined: 24.08.2006
Age: 68
With us: 18 years 2 months
Location: NJ USA

Post #2by LordFerret » 19.07.2007, 22:35

rthorvald,

Is it possible to have full speed at once?

I've had problems with the acceleration/deceleration too. See the Move command in the Scripting Guide documentation.

Your Goto statement is set for 1 second of travel time... I'm surprised you even notice acceleration/deceleration to the object. You also need to use a Wait statement of equal-to or greater-than time duration of the Goto statment, such as -
goto { time 1 distance 4 }
wait { duration 1 }

I've never tried to use Goto and Orbit simultaneously.

Topic author
rthorvald
Posts: 1223
Joined: 20.10.2003
With us: 21 years 1 month
Location: Norway

Post #3by rthorvald » 19.07.2007, 22:45

LordFerret wrote:Your Goto statement is set for 1 second of travel time... I'm surprised you even notice acceleration/deceleration to the object..


Oh, sorry, that was just an example, i just wrote it rather than copying the proper code; the travel time is more than 10 seconds.

The problem, of course, is that i alreadt have the camera moving along one trajectory, but want it to switch to a different one WITHOUT slowing down...

- rthorvald
Image

Avatar
LordFerret M
Posts: 737
Joined: 24.08.2006
Age: 68
With us: 18 years 2 months
Location: NJ USA

Post #4by LordFerret » 19.07.2007, 23:30

I had a similar problem in a CEL script I've been working on (not finished yet), it's a demonstration of sorts of travel at light-speed (for the kids). Starting at the surface of Sol (equivalent of the chromosphere), the script takes you to Earth. Along the way the approximate orbits of Mercury and Venus are noted. To accomplish this I used the MOVE command. With the velocity set to light-speed and traveling at set times to reach the approximate orbit distances, I'm able to print the appropriate screen messages and then immediately execute the next MOVE command... no pause, no acceleration/deceleration (or at least what there is of it is nominal). Heh... it's long ride, hard to keep from not being boring... but it does demonstrate the point.

I'm supposing you could also use MOVE commands, back-to-back, changing your trajectory as desired with each successive command.

Topic author
rthorvald
Posts: 1223
Joined: 20.10.2003
With us: 21 years 1 month
Location: Norway

Post #5by rthorvald » 20.07.2007, 20:20

Thanks for your suggestions, LordFerret!
I solved the first one by attaching the camera to XYZs.

- rthorvald
Image

Avatar
LordFerret M
Posts: 737
Joined: 24.08.2006
Age: 68
With us: 18 years 2 months
Location: NJ USA

Post #6by LordFerret » 22.07.2007, 07:42

Thinking back on this, I've improperly defined my use of the command - as far as displaying messages goes. Sorry.

A more accurate example would be (approximate durations) -

Code: Select all

# moving away from sol
move { duration 185 velocity [0 0 -299792.458] }

# at the appropriate number of seconds out...
print { text "say something about mercury orbit here" duration 10 }
move { duration 10 velocity [0 0 -299792.458] }

# continue onward
move { duration 165 velocity [0 0 -299792.458] }


Notice the 2nd move usage... it's purpose is to take the place of the wait command.


Return to “Scripting”