Page 1 of 1
Can you display a model in Celestia dynamically?
Posted: 13.01.2007, 08:04
by hharris
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
Posted: 13.01.2007, 12:08
by selden
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.
Posted: 13.01.2007, 18:27
by hharris
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?
Posted: 13.01.2007, 18:44
by selden
Chris provided an example in the thread
Pointing Hubble although it doesn't seem to point in quite the right direction.
Posted: 13.01.2007, 19:16
by hharris
I read the "pointing hubble" thread but now I'm really confused. Is there any documentation for version 1.5.0 available yet?
Henry
Posted: 13.01.2007, 21:25
by selden
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...
Posted: 15.01.2007, 11:07
by makc
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?
Posted: 15.01.2007, 20:32
by hharris
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
Posted: 17.01.2007, 03:13
by hharris
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
Posted: 17.01.2007, 11:24
by selden
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.
Posted: 17.01.2007, 12:08
by hharris
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
Posted: 17.01.2007, 12:09
by Vincent
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...
Posted: 22.01.2007, 01:20
by fsgregs
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:
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
Frank