Can you display a model in Celestia dynamically?

The place to discuss creating, porting and modifying Celestia's source code.
Topic author
hharris
Posts: 79
Joined: 23.02.2006
With us: 18 years 8 months
Location: Pasadena, CA 91104

Can you display a model in Celestia dynamically?

Post #1by hharris » 13.01.2007, 08:04

I'm thinking about adding a "lander" to my CelestiaExplorer script. What this means is that you would be able to "exit" your virtual spacecraft. On the screen would be a lander display with appropriate controls for landing. But of course you should be able to see the spacecraft you were undocking the lander from.

My question is ... is it possible to display a model in a specific location dynamically? And if so, how would this be accomplished?

Thanks!

Henry

Avatar
selden
Developer
Posts: 10192
Joined: 04.09.2002
With us: 22 years 2 months
Location: NY, USA

Post #2by selden » 13.01.2007, 12:08

In principle one could create a Lua script for v1.5.0 that would move models around. I don't think anybody has tried to do it yet.

Depending on the kind of motion, one could also use a script that would change the model's orientation: rotating an appropriately designed model could make the spacecraft seem to travel along an arc.
Selden

Topic author
hharris
Posts: 79
Joined: 23.02.2006
With us: 18 years 8 months
Location: Pasadena, CA 91104

Post #3by hharris » 13.01.2007, 18:27

That's great news. I assume this must mean that a model defined by the user can be accessed using the getchildren method. But how do you modify its characteritics (such as its orientation) in real time?

Avatar
selden
Developer
Posts: 10192
Joined: 04.09.2002
With us: 22 years 2 months
Location: NY, USA

Post #4by selden » 13.01.2007, 18:44

Chris provided an example in the thread Pointing Hubble although it doesn't seem to point in quite the right direction.
Selden

Topic author
hharris
Posts: 79
Joined: 23.02.2006
With us: 18 years 8 months
Location: Pasadena, CA 91104

Post #5by hharris » 13.01.2007, 19:16

I read the "pointing hubble" thread but now I'm really confused. Is there any documentation for version 1.5.0 available yet?

Henry

Avatar
selden
Developer
Posts: 10192
Joined: 04.09.2002
With us: 22 years 2 months
Location: NY, USA

Post #6by selden » 13.01.2007, 21:25

Not really.

There are quite a few bits and pieces here and there, but nothing that clearly describes how to implement a ScriptedOrbit or a ScriptedRotation from the beginning. (They don't work at all for me: Celestia spews error messages at an unreadable rate, one for each frame it draws.)

Vincent puzzled out how to do some of it for the Lua Edu package, but that's both overkill for this and doesn't implement the ScriptedRotation any more. Maybe he can help, though. See the thread Lua Edu Tools : content and layout...
Selden

makc
Posts: 18
Joined: 09.01.2007
With us: 17 years 10 months

Post #7by makc » 15.01.2007, 11:07

Isn't it possible to actually put observer in the spaceship, so he would see things through some kind of window, and then actually move observer out of the ship?

Topic author
hharris
Posts: 79
Joined: 23.02.2006
With us: 18 years 8 months
Location: Pasadena, CA 91104

Post #8by hharris » 15.01.2007, 20:32

CelestiaExplorer does that, except to move out of the ship (which you can't do now) you would see the vehicle you have been traveling in. That and simulating lander physics might be an interesting addition, but it sounds like this might be more a project for the next version of Celestia.

Henry

Topic author
hharris
Posts: 79
Joined: 23.02.2006
With us: 18 years 8 months
Location: Pasadena, CA 91104

Post #9by hharris » 17.01.2007, 03:13

Selden,

I've reread the "pointing hubble" thread you recommended and found I'd missed the salient point. To point hubble you have to exit Celestia, go to the ssc text file, edit its parameters, and then reload Celestia.

Here's my real question (although I think I already know the answer):

Are the data structures, created when an scc file is read in, available during program execution? Certainly this must be possible in principle.

If not, I'd like to lobby for that capability be added in the future, if possible. It would open up a lot of possiblities. I also realize there might be an efficiency problem here since compilation may wrap everthing up in a form that is difficult or even impossible to modify.

Henry :wink:

Avatar
selden
Developer
Posts: 10192
Joined: 04.09.2002
With us: 22 years 2 months
Location: NY, USA

Post #10by selden » 17.01.2007, 11:24

In principle, the orientation of a body (e.g. a telescope or spacecraft) can be controlled in realtime by a Lua routine. Despite Chris' example code, I have not yet been able to get it to work.

As best I can tell, and I could be mistaken (I have not yet looked at the C++ code), one of many problems for the novice is that the angles used by Celestia to update an object's orientation while redrawing the screen are stored as quaternions, not as polar coordinates similar to RA and Dec.
Selden

Topic author
hharris
Posts: 79
Joined: 23.02.2006
With us: 18 years 8 months
Location: Pasadena, CA 91104

Post #11by hharris » 17.01.2007, 12:08

Well, of course, what the Celestia documentation refers to as "rotations" are in fact quaternions. But as far as I know, all the operations that are defined for quaternions are about setting the orientation of the observer, not the orientation of a model. I have no problem with using quaternions. They are, mathmatically speaking, a very well-behaved way of describing and modifying 3D rotations.

Henry :)

Vincent
Developer
Posts: 1356
Joined: 07.01.2005
With us: 19 years 10 months
Location: Nancy, France

Post #12by Vincent » 17.01.2007, 12:09

hharris wrote:I've reread the "pointing hubble" thread you recommended and found I'd missed the salient point. To point hubble you have to exit Celestia, go to the ssc text file, edit its parameters, and then reload Celestia.

Henry,

I've modified Selden's "Pointing Hubble" addon to make Hubble point at the current selection, i.e., to make Hubble's orientation change everytime a new object is selected (of course, without restarting Celestia). To do that, I've used the scriptedRotation definition and the Lua script that Chris provided in the "Pointing Hubble" thread. I've even nearly managed to give users the possibility to rotate Hubble arounds its 3 axis using some "Rot X", "Rot Y", "Rot Z" active buttons.

However, as evocated by Selden, there seems to be a bug whether in the script or in the Celestia code itself. That's why I've given up trying to finalize this addon.

There's good news, though : Chris ensured me via PM that he is currently investigating the problem... :)
@+
Vincent

Celestia Qt4 SVN / Celestia 1.6.1 + Lua Edu Tools v1.2
GeForce 8600 GT 1024MB / AMD Athlon 64 Dual Core / 4Go DDR2 / XP SP3

Avatar
fsgregs
Posts: 1307
Joined: 07.10.2002
With us: 22 years 1 month
Location: Manassas, VA

Post #13by fsgregs » 22.01.2007, 01:20

Isn't it possible to actually put observer in the spaceship, so he would see things through some kind of window, and then actually move observer out of the ship


Is is possible now to view space through the window of your spaceship, then use a cel:url or a bookmark to move your view outside of the ship, looking toward it. Once outside, you can move around the ship any way you wish. As an example, here is a screenshot of your Celestia spaceship, looking at it through the ship's window:

Image

The ship model is called the Celestia 1, and is on the motherlode. The cockpit is a custom add-on that is part of the educational activity series. However, two other forum members (Boux and Andrea), just reworked the cockpit to make it more dynamic. See this thread:

http://celestiaproject.net/forum/viewtopic.php ... c&start=15

Hope this helps


:D

Frank


Return to “Development”