Fixed viewpoint position in scripts?

All about writing scripts for Celestia in Lua and the .cel system
Topic author
eafbsd
Posts: 31
Joined: 12.10.2007
With us: 16 years 7 months
Location: na

Fixed viewpoint position in scripts?

Post #1by eafbsd » 11.06.2008, 19:19

I've created .cel scripts for all of the space objects downloaded from the Motherlode. While going the the Scripting Guide, there are links where the camera remains steady while moons and asteroids fly passed. I've tried every scripting command listed, Lock, Track, Follow, etc., and for some reason haven't been able to duplicate this action. I would love to be able to remain on Saturn or Jupiter and watch the moons come from out of the darkness and fly past the planets. Am I missing something? .Cel scripts are the limit of my abilities, so I can use all the help I can get. Thanks in advance, EAFBSD

BobHegwood
Posts: 1803
Joined: 12.10.2007
With us: 16 years 7 months

Re: Scripting forum

Post #2by BobHegwood » 11.06.2008, 20:42

eafbsd wrote:I've created .cel scripts for all of the space objects downloaded from the Motherlode. While going the the Scripting Guide, there are links where the camera remains steady while moons and asteroids fly passed. I've tried every scripting command listed, Lock, Track, Follow, etc., and for some reason haven't been able to duplicate this action. I would love to be able to remain on Saturn or Jupiter and watch the moons come from out of the darkness and fly past the planets. Am I missing something? .Cel scripts are the limit of my abilities, so I can use all the help I can get. Thanks in advance, EAFBSD

Have you tried the GOTOLONGLAT command? This allows you place your point of view at a very precise location. Don't know if that helps or not, but it might be worth a try. :wink:

An example from my Venus Tour (The one I'm currently working on) follows below. You may be able to use a similar kind of positioning for the objects you're trying to get to. Just FYI.
gotolonglat {time 5.0 distance 3.0 longitude -135.0 latitude 35.0}

Then, you can either follow this object (via follow {}) or you can just place yourself off of the surface of a planet in the right position to be able to see what you're trying to allow in the view.

Hope that helps and good luck.

Brain-Dead Bob
Brain-Dead Geezer Bob is now using...
Windows Vista Home Premium, 64-bit on a
Gateway Pentium Dual-Core CPU E5200, 2.5GHz
7 GB RAM, 500 GB hard disk, Nvidia GeForce 7100
Nvidia nForce 630i, 1680x1050 screen, Latest SVN

Topic author
eafbsd
Posts: 31
Joined: 12.10.2007
With us: 16 years 7 months
Location: na

Re: Scripting forum

Post #3by eafbsd » 14.06.2008, 15:17

Brain Dead Bob - Thank you for your quick response, I really appreciate it. I used the "gotolonglat" example in the scripting guide, now I'm orbiting above Seattle. I'll start playing with looking backward and the longitude and latitude positions and see what happens. Again, thank you...

Topic author
eafbsd
Posts: 31
Joined: 12.10.2007
With us: 16 years 7 months
Location: na

Re: Scripting forum

Post #4by eafbsd » 27.06.2008, 19:24

Bob, I tried, I really did. But I can't make the camera stay stationary and hve the objects come to it. I've printed out my scripts, studied them, and... I don't know, no matter which space object I "select" I can't stop the camera from moving to it. So, let me you about the "goto" command. Is this what's causing my problem? Is there some kind of "bring it to me" command? Because that's what I think I need, instead of telling the camera to "goto" an object, I would be able to tell the camera to "bring" the object to me. Is there any help for me????

BobHegwood
Posts: 1803
Joined: 12.10.2007
With us: 16 years 7 months

Re: Fixed viewpoint position in scripts?

Post #5by BobHegwood » 27.06.2008, 21:15

You can position the camera via the gotolonglat command, but then you must wait for the event to occur. If it is going to occur in front of you, then you have to do nothing except speed the time up. If it is going to occur to the left, right, top, or bottom of you, then you simply need to adjust the gotolonglat parameters so that you are in the right place to view the event.

If you can't do this using a planet or moon, then you can do it using a fictional (and not displayed) object via the Class "invisible"
property. Then, you can absolutely go to exactly where your "camera" needs to be placed. Does this help?
If not, I'm afraid that someone smarter than myself will have to help out here. Maybe a barycenter could be used?

Also, when you say
instead of telling the camera to "goto" an object, I would be able to tell the camera to "bring" the object to me.
I don't think you are understanding what I'm saying. You do NOT have to "bring" it to you... You have to position the camera so that the event unfolds in front of the view.
Make sense now?

Thanks, Brain-Dead Bob
Brain-Dead Geezer Bob is now using...
Windows Vista Home Premium, 64-bit on a
Gateway Pentium Dual-Core CPU E5200, 2.5GHz
7 GB RAM, 500 GB hard disk, Nvidia GeForce 7100
Nvidia nForce 630i, 1680x1050 screen, Latest SVN

BobHegwood
Posts: 1803
Joined: 12.10.2007
With us: 16 years 7 months

Re: Fixed viewpoint position in scripts?

Post #6by BobHegwood » 27.06.2008, 21:45

Just on the off-chance that you haven't done this yet, go to the Motherlode and download my old Jupiter script HERE.
The only reason I suggest this is because I think it already does what you are trying to do, but it does it on different objects. If this is not the case, then please forgive my suggestion here. I don't think as well as I used to now, and I never really thought all that well in the first place. :wink:

Just thought this might be worth a try for you though.

NOTE to Selden: Thanks for the move! :)

Thanks, Bob
Brain-Dead Geezer Bob is now using...
Windows Vista Home Premium, 64-bit on a
Gateway Pentium Dual-Core CPU E5200, 2.5GHz
7 GB RAM, 500 GB hard disk, Nvidia GeForce 7100
Nvidia nForce 630i, 1680x1050 screen, Latest SVN

Topic author
eafbsd
Posts: 31
Joined: 12.10.2007
With us: 16 years 7 months
Location: na

Re: Fixed viewpoint position in scripts?

Post #7by eafbsd » 12.07.2008, 18:34

Dear Mr. BrainDead,
The last thing I ever wanted to do was become a pain, but... Here I go again. In the Celestia Users Guide 1.4.1, page 31 of 46, Track Section [T], 56), there is a link where "you will be taken to a position in space above the asteroid Gaspra. You are tracking it and as you watch it coming at you, your view will swing as it flies by ... and you watch it recede."
What I need to do, have to do, is make this same sequence of events happen using .cel commands. Is it possible to "goto" Earth and then watch the moon fly by just as Gaspra did in the Users Guide example?
What I like to do is have just a small portion of earth locked in the lower right-hand portion of the screen (about as big as your fist), and then have the moon appear, as if on its normal orbit, and fly by. My goal is to do this with all the planets and all their moons.
I tried studying the Lua Scripting Guide, and that almost made me "brain dead". I need help and I don't know where else to go.
eafbsd

BobHegwood
Posts: 1803
Joined: 12.10.2007
With us: 16 years 7 months

Re: Fixed viewpoint position in scripts?

Post #8by BobHegwood » 13.07.2008, 00:50

Okay, I really did not understand what you wanted here, I think...

See the following code and play with it a bit. It is not what you are doing, but it does contain a way to position
the camera like you were talking about. Right now, I have the camera positioned off of the surface of the Earth, and
looking out into space in the direction of a particular star. I did this to show you that you can position the camera
to point anywhere you like. In this case, I wanted to see the Moon over the Earth. See if this might help.
Play with it, and adjust it so that you are using Jupiter instead of the Earth. Change the star pointed to and just
play around with it. Pay particular attention to the date though. Remember that things are located in both space AND
time in the universe. :wink:

Code: Select all

{
time {jd 2454658.02255}
set {name "FOV" value 35.0}
select {object "Sol/Earth"}
center {time 4.0}
wait {duration 4.0}
gotolonglat {time 3.0 distance 6.5 longitude -105 latitude 40.0}
wait {duration 4.0}
follow {}
select {object "Gliese 570 B-C"}
center {time 2.0}
wait {duration 2.0}
}
Brain-Dead Geezer Bob is now using...
Windows Vista Home Premium, 64-bit on a
Gateway Pentium Dual-Core CPU E5200, 2.5GHz
7 GB RAM, 500 GB hard disk, Nvidia GeForce 7100
Nvidia nForce 630i, 1680x1050 screen, Latest SVN

BobHegwood
Posts: 1803
Joined: 12.10.2007
With us: 16 years 7 months

Re: Fixed viewpoint position in scripts?

Post #9by BobHegwood » 10.08.2008, 17:00

Eafbsd,

Please view the topic located HERE and download Linuxman's superb 2001 package.
You will find - within his CEL scripts - exactly what you are trying to do with positioning yourself at a
particular place in time and space in order to view the Moon rise you are trying to get to I believe.

Hope this helps. :wink:
Brain-Dead Geezer Bob is now using...
Windows Vista Home Premium, 64-bit on a
Gateway Pentium Dual-Core CPU E5200, 2.5GHz
7 GB RAM, 500 GB hard disk, Nvidia GeForce 7100
Nvidia nForce 630i, 1680x1050 screen, Latest SVN


Return to “Scripting”