rotating a spacecraft

All about writing scripts for Celestia in Lua and the .cel system
Topic author
trenner
Posts: 58
Joined: 27.09.2002
With us: 17 years 11 months
Location: Nanaimo, B.C., Canada

rotating a spacecraft

Post #1by trenner » 09.03.2005, 06:54

Would it be possible to write and bring up a script that rotates a spacecraft after it is brought onto the screen. It's a bit tedious trying to look over the craft with the arrow buttons and the mouse
thanks
Terry

Bob Hegwood
Posts: 1048
Joined: 19.10.2003
With us: 16 years 11 months
Location: Germantown, Ohio - USA

Post #2by Bob Hegwood » 13.03.2005, 18:19

Terry,

You should be able to make your spacecraft do whatever you want it to do
by modifying some of the parameters in an SSC file which describes your
spacecraft.

The following code describes Jestr's and Frank's 2001 Discovery spacecraft. Note that entries starting with the # sign are comments.

"Discovery" "Sol/Jupiter/Io"
{
#Discovery abandoned at Jupiter/Io L1 point

Class "spacecraft"
Beginning "2020 01 01 01:00:00"
Mesh "Discovery.3ds"
Radius 0.05 #100 metres long

EllipticalOrbit
{
Period 1.7691378 #synchronous with Io
SemiMajorAxis 10540 #0.025 of Jupiter-Io distance
MeanLongitude 220 #positioned on a line between Jupiter and Io
}

RotationPeriod 0.06 #slow "several minutes" tumble

Obliquity 90 #rotating at right angles to orbit
Orientation [90 0 0 1] #make rotation end-over-end

Albedo 0.01
}


Try writing an SSC similar to this one for whatever ship you'd like to
view. Also, feel free to modify the various parameters to see what you
can accomplish in terms of rotation and your viewing pleasure.

Also, you should change the "Beginning" date information so that you
can view your spacecraft in whatever timeframe you like.

Hope this helps.

Take care, Bob
Bob Hegwood
Windows XP-SP2, 256Meg 1024x768 Resolution
Intel Celeron 1400 MHz CPU
Intel 82815 Graphics Controller
OpenGL Version: 1.1.2 - Build 4.13.01.3196
Celestia 1.4.0 Pre6 FT1

Topic author
trenner
Posts: 58
Joined: 27.09.2002
With us: 17 years 11 months
Location: Nanaimo, B.C., Canada

Post #3by trenner » 14.03.2005, 03:49

Thanks Bob! This is exactly what I'm looking for. I've played around with some of the other scripts, but things always got pretty messy. Hopefully I can finally contribute something.
I've had to bring up a script in wordpad, then cut and past to keep it as a *.cel. I can't seem to save without it turning into an unformatted text document. Could you guide me on this ?
Thanks!

Terry

Bob Hegwood
Posts: 1048
Joined: 19.10.2003
With us: 16 years 11 months
Location: Germantown, Ohio - USA

Post #4by Bob Hegwood » 14.03.2005, 12:11

trenner wrote:I've had to bring up a script in wordpad, then cut and past to keep it as a *.cel. I can't seem to save without it turning into an unformatted text document. Could you guide me on this ?

I simply use Windows Notepad to write scripts and ssc files. Just save the
file as a plain old .txt file, then rename it when your finished. Piece of cake.

In other words, if I have a Mercury Touring script written up, I'll just save it
as MercuryTour.txt. Then, I'll simply right-click on the file to rename it to
MercuryTour.cel. This works just fine on my Windows XP machine. I try to
avoid using Wordpad if I can. It likes to add formatting that I don't want.

Hope that helps.

Take care, Bob
Bob Hegwood

Windows XP-SP2, 256Meg 1024x768 Resolution

Intel Celeron 1400 MHz CPU

Intel 82815 Graphics Controller

OpenGL Version: 1.1.2 - Build 4.13.01.3196

Celestia 1.4.0 Pre6 FT1

Topic author
trenner
Posts: 58
Joined: 27.09.2002
With us: 17 years 11 months
Location: Nanaimo, B.C., Canada

Post #5by trenner » 18.03.2005, 04:46

OK! Whatablast!
Attention all computer/ animation illiterates - like me. This is easy! It's sort of like trying to do a convoluted 3D crossword that bites back....
I wish to thank all creators and script writers that I am borrowing shamelessly from. I look forward to any and all critique
I couldn't wait to share this. Sure, it's fatally gimped, but it's my first!


{
# This script will give a tour of the spaceships
#------------------------------------------------------------

renderflags {clear "orbits|constellations|comettails|boundaries"}
renderflags {clear "pointstars|nightmaps|galaxies|markers"}
renderflags {set "cloudmaps|eclipseshadows|atmospheres|nightmaps"}
#labels {clear "planets|moons|spacecraft|asteroids|constellations|stars|galaxies"}
set {name "AmbientLightLevel" value 0.30}
set {name "FOV" value 30.0}
time { utc "2007-03-15T19:50:29.92431" }
preloadtex { object "Sol/Earth" }
preloadtex { object "Sol/Earth/Moon" }

select {object "Sol/Earth"}
synchronous {}
gotolonglat {time 3.0 distance 5.0 up [ 0 1 0 ] longitude -110 latitude 20}
wait {duration 2.0}
print {text "Welcome to the home for ALL of us. Earth" row -3 column 1 duration 20}
wait {duration 6.0}
print {text "We will first look for, and travel, to ISS" row -3 column 1 duration 20}
wait {duration 3.0}
select {object "Sol/Earth/ISS"}
preloadtex { object "Sol/Earth/ISS" }
center { time 1.5 }
renderflags { set "markers" }
unmark { object "Sol/Earth/ISS" }
mark { object "Sol/Earth/ISS" size 20 color [0 1 0] symbol "x" }
follow {}
print {text "The ISS is truely a marvel of Human creation" row -3 column 1 duration 20}
wait {duration 4.0}
gotolonglat {time 5.0 distance 5.0 up [ 1 0 0 ] longitude -130 latitude 0}
renderflags { clear "markers" }
wait {duration 3.0}
orbit {axis [0 0 1] rate 8 duration 20}
goto {time 6.0 distance 2.5}
wait {duration 3.0}
orbit {axis [0 1 0] rate 8 duration 12}
wait {duration 3.0}
orbit {axis [1 0 0] rate 8 duration 10}
goto {time 6.0 distance 8.0}
print {text "We will now travel to another marvel, the Hubble Telescope" row -3 column 1 duration 14}
wait {duration 8.0}
set {name "AmbientLightLevel" value 0.15}
gotolonglat {time 5.0 distance 5.0 up [ 1 0 0 ] longitude 130 latitude 40}
select {object "Sol/Earth/Hubble"}
preloadtex { object "Sol/Earth/Hubble" }
follow {}
center {time 5.0}
goto {time 6.0 distance 5.0}
orbit {axis [0 0 1] rate 7 duration 8}
print {text "The Hubble has accounted for itself well, with
many outstanding images." row -3 column 1 duration 11}
orbit {axis [0 -1 0 ] rate 7 duration 10}
select {object "Sol/Earth/Hubble"}
follow {}
orbit {axis [-1 0 0] rate 7 duration 4}
goto {time 6.0 distance 3.0}
orbit {axis [0 1 0] rate 7 duration 31}
wait {duration 3.0}
goto {time 6.0 distance 8.0}
print {text "next we visit the Chandra X-ray Observatory" row -3 column 1 duration 13}
wait {duration 6.0}
select {object "Sol/Earth/Chandra X-ray Observatory"}
preloadtex { object "Sol/Earth/Chandra X-ray Observatory" }
follow {}
goto {time 8.0 distance 5.8}
orbit {axis [0 1 0] rate 15 duration 19}
wait {duration 5.0}
print {text "Chandra X-ray Observatory again" row -3 column 1 duration 13}
select {object "Sol/Earth/Chandra X-ray Observatory"}
follow {}
goto {time 3.0 distance 4.0}
preloadtex { object "Sol/Earth/Chandra X-ray Observatory" }
wait {duration 3.0}
orbit {axis [0 1 0] rate 30 duration 1.5}
orbit {axis [-1 0 0 ] rate 10 duration 4.5}
orbit {axis [0 1 0] rate 10 duration 1.35}
orbit {axis [-1 0 0 ] rate 10 duration 1.5}
orbit {axis [0 -1 0] rate 10 duration 3.3}
select {object "Sol/Earth/Chandra X-ray Observatory"}
synchronous {}
goto {time 6.0 distance 3.0}
goto {time 6.0 distance 8.0}
print {text "next we pass the Endeavour" row -3 column 1 duration 13}
wait {duration 6.0}
select {object "Sol/Earth/Endeavour"}
preloadtex { object "Sol/Earth/Endeavour" }
follow {}
goto {time 6.0 distance 5.8}
orbit {axis [1 0 0] rate 10 duration 16.5}
goto {time 6.0 distance 2}
wait {duration 4.0}
print {text "Endeavour again" row -3 column 1 duration 13}
select {object "Sol/Earth/Endeavour"}
follow {}
goto {time 3.0 distance 3}
preloadtex { object "Sol/Earth/Endeavour" }
wait {duration 3.0}
orbit {axis [0 1 0] rate 20 duration 4.5}
orbit {axis [1 0 0 ] rate 10 duration 3.5}
orbit {axis [0 0 1] rate 10 duration 3.3}
wait {duration 4.0}
select {object "Sol/Earth/Endeavour"}
synchronous {}
goto {time 6.0 distance 8.0}
wait {duration 6.0}
select { object "Sol/Earth" }
goto { time 20 distance 10 upframe "equatorial" }
wait { duration 20.0 }
print { text "Demo completed." row -3}
wait { duration 3.0 }
}


Honest. It's easy. And fun! Let's have a competition

Regards
Terry Renner


Return to “Scripting”

Who is online