ScriptedRotation in 1.5.0

All about writing scripts for Celestia in Lua and the .cel system
Topic author
bdm
Posts: 461
Joined: 22.07.2005
With us: 19 years 4 months
Location: Australia

ScriptedRotation in 1.5.0

Post #1by bdm » 21.01.2008, 02:20

In the thread 1.5.0 features, Chris mentioned the creation of scripted rotation here:
* New rotation models:
- In previous versions of Celestia, all objects rotated uniformly about a
single axis (with optional precession about the z-axis.) Celestia 1.5.0
introduces the concept of a generic rotation model, which is some function
that specifies the orientation of an object over time.
- Rotation models available in Celestia 1.5.0:
- FixedRotation: For an object with an orientation that remains fixed
within its reference frame. This was a notable omission in older version
of Celestia.
- UniformRotation: Describes a rotation of a constant rate about a fixed
axis.
- PrecessingRotation: UniformRotation plus a precession rate.
- SampledOrientation: Analagous to SampledOrbit for position.
SampledOrientation specifies a file of time tagged quaternions which
are interpolated to give the orientation of an object.
- ScriptedRotation: Allows the orientation of an object to be controlled
by a Lua script.


I would like to try out the ScriptedRotation stuff, but don't know enough about Lua and .celx to get this up and running. Does anyone have a few working examples of ScriptedRotation for 1.5.0 that I can study and modify to try out the capabilities of this new feature? I'm the sort of person that learns much more quickly from a working example than by reading the documentation to create the working example from scratch: having a working example allows me to look up the documentation from the working example, rather than the other way around.

My intention is to model a world that is about to enter tidal lock; the angular rotation relative to the parent body would decrease linearly to zero, after which it stays at zero after the world enters tidal lock.

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

Post #2by selden » 21.01.2008, 12:58

There are some examples in the Celestia Wikibook. http://en.wikibooks.org/wiki/Celestia

I've also used Scripted functions in my Hale Telescope Addon, but they may be rather hard to disentangle from their environment.
Selden

Topic author
bdm
Posts: 461
Joined: 22.07.2005
With us: 19 years 4 months
Location: Australia

Post #3by bdm » 21.01.2008, 23:26

Thanks Selden, this is useful and I will read this carefully.

http://en.wikibooks.org/wiki/Celestia/R ... edRotation


Return to “Scripting”