Page 1 of 1

Interactive positioning of SSC objects.

Posted: 02.07.2007, 18:10
by selden
Celestia v1.5 provides support for ScriptedOrbit and ScriptedRotation functions. Since these functions run in a separate context, they do not (yet?) have access to the keyboard or joystick. However, these functions can determine what object is currently selected.

If one defines appropriate DSC objects, one can use them to communicate with ScriptedOrbits and thus cause the object controlled by that script to move arbitrarily.

A very simple and crude example of such control is available in
http://www.lepp.cornell.edu/~seb/celest ... ontrol.zip

It's about 1MB since I left in the files used to develop the rather simple spacecraft model that it uses.

Here's an example of a split-screen control:

Image

The upper pane is the object being controlled, positioned above the reference object located where it started.
The lower half shows the three DSC objects one selects to move it: Fwd, Stop & Rev. One can also watch the object in a full-screen window and select the objects by typing their names.

Expanding on this to provide full 3D control of an object is left as an exercise for the student. ;)

Re: manual positioning of SSC objects.

Posted: 02.07.2007, 18:41
by hank
selden wrote:Celestia v1.5 provides support for ScriptedOrbit and ScriptedRotation functions. Since these functions run in a separate context, they do not (yet?) have access to the keyboard or joystick. However, these functions can determine what object is currently selected.
...
One can also watch the object in a full-screen window and select the objects by typing their names.

I suppose one could also write a user script with keyboard input that responds to a particular key press by selecting one of the DSC control objects.

- Hank

Posted: 02.07.2007, 18:57
by selden
Hank,

Yup, you're right!

Related comment:

For some reason, my attempts to directly compare selected objects with "found" objects always returned a false. I wound up having to test the distance between the selected object and the control objects. Maybe I was just doing something wrong. In particular, I couldn't seem to get something like this to work:

Code: Select all

Vel = function ()
local c1 = celestia:find("Fwd")
local c2 = celestia:find("Stop")
local c3 = celestia:find("Rev")
local s1 = celestia:getselection()


  if (s1 == c2) then return 0
    elseif (s1 == c1) then return 1e4
    elseif (s1 == c3) then return -1e4
    else   return vP
  end

end


It always seemed to take the "else" branch. :(

Posted: 02.07.2007, 19:23
by hank
selden wrote:For some reason, my attempts to directly compare selected objects with "found" objects always returned a false. I wound up having to test the distance between the selected object and the control objects.

My guess would be that the celx functions are returning copies, so the identity test fails. But why not just check the name of the current selection?

- Hank

Posted: 02.07.2007, 19:36
by selden
uhhh.. because I didn't think of it.

I was expecting to be able to compare the object ID and when that failed, tried other things that used it... *sigh*

Posted: 28.07.2007, 05:23
by ElecMoHwk
So... once this is fully into Celestia, I could in theory (and with some time for development for models, and the innards of Celestia orbits and rotations and such) ...

... Load up ElChristou's Atlantis... open the bay doors, close them, perform RCS burns, and even rotate to dock with ISS? All from typed in keyboard commands?

I will NEVER leave the house again. :P

Posted: 28.07.2007, 11:37
by selden
ElecMoHwk,


Almost ;-)

This technique depends on having separate SSC objects for each of the movable pieces.