RELEASE: The Flight of Buran

Post requests, images, descriptions and reports about work in progress here.
chris
Site Admin
Posts: 4211
Joined: 28.01.2002
With us: 22 years 10 months
Location: Seattle, Washington, USA

Post #21by chris » 15.02.2008, 19:20

Would it be useful to have a script that allows you to modify the orientation of the selected object interactively and then record those orientations for use in a SampledOrientation .q file?

--Chris

Avatar
Cham M
Posts: 4324
Joined: 14.01.2004
Age: 60
With us: 20 years 10 months
Location: Montreal

Post #22by Cham » 15.02.2008, 20:49

chris wrote:Would it be useful to have a script that allows you to modify the orientation of the selected object interactively and then record those orientations for use in a SampledOrientation .q file?

--Chris


Of course ! And what about the "edit mode" of Celestia (alt-@, in OS X) ? We should take advantage of this *probably* unknown and under-used function of our favorite software.
"Well! I've often seen a cat without a grin", thought Alice; "but a grin without a cat! It's the most curious thing I ever saw in all my life!"

chris
Site Admin
Posts: 4211
Joined: 28.01.2002
With us: 22 years 10 months
Location: Seattle, Washington, USA

Post #23by chris » 16.02.2008, 00:34

Here's the first version of the Rotator tool:

http://www.celestiaproject.net/~claurel/celest ... or-0.1.zip

I hope that it's useful. Usage information from the readme (included in the zip file):


== Rotator for Celestia ==

Rotator is a tool for interactively rotating objects inside Celestia and
capturing the orientations to a file for use in a SampledOrientation. It is
designed to help add-on creators correctly orient their models.


== Installation ==

Rotator uses Celestia's Lua hook mechanism. The file luarotate.lua must be
installed in the same folder as celestia.cfg. You'll have to edit celestia.cfg
and add the following line someplace:

LuaHook "luarotate.lua"

When you start Celestia with this hook script, the usual functions of the
number keys and the ! key will be overridden. You'll have to remove the LuaHook
line to reset these keys to their usual functions.

In your add-on folder, you should copy the celxx folder included with this
package. It contains a single script file called keyboardrotation.lua that
defines a ScriptedRotation function. The structure of your add-on folder
should look like something like this:

Code: Select all

addon/
   addon.ssc
   data/
       traj.xyz
   textures/
       texture1.jpg
       texture2.jpg
   celxx/
       keyboardrotation.lua


Next, you'll need to modify the definition for object in your ssc file that
you want to orient. Comment out any rotation model--FixedRotation,
UniformRotation, SampledOrientation, etc., and add the following lines:

Code: Select all

ScriptedRotation
{
    Module "keyboardrotation"
    Function "kbrotation"
    Id "NAME"
}


...replacing NAME with whatever the name of your object actually is.

You can do this for all objects that you want to orient interactively with the
Rotator tool.


== Running Rotator ==

After installation, start up Celestia and select the object you're interested
in rotating. The following keys are now active:

1 / 2 : Rotate selected object about x-axis
3 / 4 : Rotate selected object about y-axis
5 / 6 : Rotate selected object about z-axis
0 : Reset the orientation of the selected object
! : Log the rotation to a file

Use the number keys to rotate the selected object to the desired orientation.
When it's where you want it, press ! to log that orientation to a file. Repeat
for as many orientations and objects as you like.

Note that because of the way Celestia caches rotations, pausing Celestia
will prevent the orientation of objects from being update. Instead of pausing
time to edit, you can slow it down by 100x.


== Using Rotator Ouput ==

When you're done orienting objects, close Celestia and look for the file
rotations.txt. By default, the file will be located in the current folder.
You can modify this line in luarotate.lua:

logfile = "rotations.txt"

...to place the log file somewhere else (such as your home directory.) The
file will contain a list of records like this:

Code: Select all

ObjectName 0.390731 -0.920505 0.000000 0.000000
ObjectName 0.379935 -0.895071 0.091214 0.214888
ObjectName 0.237783 -0.836056 -0.332390 0.366042


The four numbers on each line are a quaternion that can be pasted into a
.q file for a SampledOrientation. A SampledOrientation file contains a list
of time+quaternion records (where the times are Julian dates). A sample .q
file looks like this:

Code: Select all

2452564.751168 -0.258753 -0.531801 -0.546416 0.593012
2452564.751261 -0.258753 -0.531801 -0.546416 0.593012
2452564.857906 -0.258753 -0.531801 -0.546416 0.593012
2452564.962073 -0.259154 -0.531602 -0.545973 0.593424
2452565.066426 -0.259020 -0.531667 -0.546122 0.593287
2452565.078741 -0.258753 -0.531801 -0.546416 0.593012
2452565.081241 -0.259837 -0.516241 -0.557344 0.596111
2452565.185500 -0.259837 -0.516241 -0.557344 0.596111


The last four numbers are each line are the quaternion components.
Last edited by chris on 16.02.2008, 00:47, edited 1 time in total.

chris
Site Admin
Posts: 4211
Joined: 28.01.2002
With us: 22 years 10 months
Location: Seattle, Washington, USA

Post #24by chris » 16.02.2008, 00:42

A couple more things regarding add-on construction and using rotator. First of all, you can usually get by without modifying the Orientation property of an object. In fact, it will be easier to use Rotator if you omit it completely. The end goal is to have the SampledOrientation file replace both Orientation and FixedRotations you've been using for Buran.

--Chris

Topic author
rthorvald
Posts: 1223
Joined: 20.10.2003
With us: 21 years 1 month
Location: Norway

Post #25by rthorvald » 16.02.2008, 00:43

chris wrote:Here's the first version of the Rotator tool:

This sounds great!
However, the download link does not work - i get a "file not found".

- rthorvald
Image

Avatar
Cham M
Posts: 4324
Joined: 14.01.2004
Age: 60
With us: 20 years 10 months
Location: Montreal

Post #26by Cham » 16.02.2008, 00:44

Thanks for the work, Chris, but I'm unable to download the file from your link given above. I'm getting an error message.
"Well! I've often seen a cat without a grin", thought Alice; "but a grin without a cat! It's the most curious thing I ever saw in all my life!"

chris
Site Admin
Posts: 4211
Joined: 28.01.2002
With us: 22 years 10 months
Location: Seattle, Washington, USA

Post #27by chris » 16.02.2008, 00:48

Cham wrote:Thanks for the work, Chris, but I'm unable to download the file from your link given above. I'm getting an error message.


Sorry. I just fixed the link.

--Chris

ElChristou
Developer
Posts: 3776
Joined: 04.02.2005
With us: 19 years 9 months

Post #28by ElChristou » 16.02.2008, 00:52

Wha, Chris that sounds cool! I don't have much time to test this right now, but many Tx for the work!
Image

Avatar
Cham M
Posts: 4324
Joined: 14.01.2004
Age: 60
With us: 20 years 10 months
Location: Montreal

Post #29by Cham » 16.02.2008, 01:11

Hmmm, I've set up a test addon to try the rotation tool, and I'm yet unable to make it to work. I followed all of your instructions (editing the config file, etc), and Celestia do nothing when I'm typing the number keys. I also tried the numeric keypad, and it's working the usual way (tilt, etc). The number keys on the left aren't working at all (do nothing).
"Well! I've often seen a cat without a grin", thought Alice; "but a grin without a cat! It's the most curious thing I ever saw in all my life!"

chris
Site Admin
Posts: 4211
Joined: 28.01.2002
With us: 22 years 10 months
Location: Seattle, Washington, USA

Post #30by chris » 16.02.2008, 01:13

Cham wrote:Hmmm, I've set up a test addon to try the rotation tool, and I'm yet unable to make it to work. I followed all of your instructions (editing the config file, etc), and Celestia do nothing when I'm typing the number keys. I also tried the numeric keypad, and it's working the usual way (tilt, etc). The number keys on the left aren't working at all (do nothing).


Are there any messages showing up in the log?

EDIT: Nevermind. I just realized that you also need to set the ScriptSystemAccessPolicy to "allow". That's the only way that you can share information between ScriptedOrbits/Rotations and the Lua hook right now. I've been looking at other ways to address this problem, but for now just change the ScriptSystemAccessPolicy in celestia.cfg.

--Chris
Last edited by chris on 16.02.2008, 01:16, edited 1 time in total.

Avatar
Cham M
Posts: 4324
Joined: 14.01.2004
Age: 60
With us: 20 years 10 months
Location: Montreal

Post #31by Cham » 16.02.2008, 01:16

Which log ? Where ?
"Well! I've often seen a cat without a grin", thought Alice; "but a grin without a cat! It's the most curious thing I ever saw in all my life!"

chris
Site Admin
Posts: 4211
Joined: 28.01.2002
With us: 22 years 10 months
Location: Seattle, Washington, USA

Post #32by chris » 16.02.2008, 01:17

Cham wrote:Which log ? Where ?


The console log that appears when you press ~

But see my edit--I think I understand what went wrong.

--Chris

Avatar
Cham M
Posts: 4324
Joined: 14.01.2004
Age: 60
With us: 20 years 10 months
Location: Montreal

Post #33by Cham » 16.02.2008, 01:21

With the "allow" set in the config file, the script is now working ! :wink:

I'll examine the output file ...
"Well! I've often seen a cat without a grin", thought Alice; "but a grin without a cat! It's the most curious thing I ever saw in all my life!"

Avatar
Cham M
Posts: 4324
Joined: 14.01.2004
Age: 60
With us: 20 years 10 months
Location: Montreal

Post #34by Cham » 16.02.2008, 01:27

Chris,

I can now rotate the model using the number keys, and use the ! to make an output. There's a file called "rotations.txt" which is then created in the base folder, but it's empty. Nothing is written in that file. Something is wrong.
"Well! I've often seen a cat without a grin", thought Alice; "but a grin without a cat! It's the most curious thing I ever saw in all my life!"

Avatar
Cham M
Posts: 4324
Joined: 14.01.2004
Age: 60
With us: 20 years 10 months
Location: Montreal

Post #35by Cham » 16.02.2008, 01:30

Haaa, I see. the numbers are saved only when I quit Celestia. It's working then ! :o
"Well! I've often seen a cat without a grin", thought Alice; "but a grin without a cat! It's the most curious thing I ever saw in all my life!"

chris
Site Admin
Posts: 4211
Joined: 28.01.2002
With us: 22 years 10 months
Location: Seattle, Washington, USA

Post #36by chris » 16.02.2008, 01:31

Cham wrote:Haaa, I see. the numbers are saved only when I quit Celestia. It's working then ! :o


Great! I can flush after each line so that output is available immediately. Let me know how else this tool can be improved. Would it be helpful to output the current time along with the rotation?

--Chris

Avatar
Cham M
Posts: 4324
Joined: 14.01.2004
Age: 60
With us: 20 years 10 months
Location: Montreal

Post #37by Cham » 16.02.2008, 03:30

chris wrote:I can flush after each line so that output is available immediately. Let me know how else this tool can be improved. Would it be helpful to output the current time along with the rotation?


It would be preferable to get the output file instantaneously, without the need to quit Celestia. Also, what is the time saved with the rotation parameters ? I think it should be preferable to have the actual time, at which the rotation is done.

EDIT : ok, I just noticed that the four numbers are just parts of a quaternion, and don't include the julian date. I suggest to add the time also in the output.
"Well! I've often seen a cat without a grin", thought Alice; "but a grin without a cat! It's the most curious thing I ever saw in all my life!"

Topic author
rthorvald
Posts: 1223
Joined: 20.10.2003
With us: 21 years 1 month
Location: Norway

Post #38by rthorvald » 16.02.2008, 18:09

chris wrote:Sorry. I just fixed the link.


Many thanks! This will be interesting...

- rthorvald
Image

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

Post #39by fsgregs » 22.02.2008, 16:51

Chris:

This tool will be very useful for add-on creators. :) That said, I don't want to sound dumb, but I am having trouble learning what the many new ssc commands do in 1.5.0. As such, I have no idea where in an ssc file to paste the data from the rotations.txt file. Does it follow the command "SampledOrientation"? Do I insert each rotations line in some kind of sequence?

Perhaps the better question to ask is whether anyone has yet written a new outline or guide of what all of the commands in an ssc for 1.5.0 do? ... something we could study and learn from?

Frank

chris
Site Admin
Posts: 4211
Joined: 28.01.2002
With us: 22 years 10 months
Location: Seattle, Washington, USA

Post #40by chris » 22.02.2008, 18:21

fsgregs wrote:Chris:

This tool will be very useful for add-on creators. :) That said, I don't want to sound dumb, but I am having trouble learning what the many new ssc commands do in 1.5.0. As such, I have no idea where in an ssc file to paste the data from the rotations.txt file. Does it follow the command "SampledOrientation"? Do I insert each rotations line in some kind of sequence?

Perhaps the better question to ask is whether anyone has yet written a new outline or guide of what all of the commands in an ssc for 1.5.0 do? ... something we could study and learn from?

Frank


Documentation on all SSC body properties is in the Celestia WikiBook:

http://en.wikibooks.org/wiki/Celestia/SSC_File

If there's anything that's not clear, let me know and I can add examples or explanations to the documentation.

Documentation on SampledOrientation is in the section on Rotation Models, though the section on SampledOrientation is a little thin right now:

http://en.wikibooks.org/wiki/Celestia/Rotation_Models

--Chris


Return to “Add-on development”