Placing objects at defined locations on planetary surfaces

Note: This uses an "empty" object model, which is unnecessary as of Celestia v1.3.0. See Defined Locations for v1.3 for how to use the new invisible object.

A couple of times recently, people have raised the problem of placing an object at or near the surface of a planet or satellite, and having it stay where it's put, as if it were resting on the surface, or hovering above it.

A synchronous orbit only works at the equator - otherwise the object ends up sliding around in a large figure-of-eight. So I've produced a workaround that allows you to do this.

1. Create a dummy object that hovers at an appropriate distance from the centre of the parent body, displaced north or south along the rotation axis.
2. Place your object in orbit around this dummy, with an orbital radius that puts it on the planetary surface, and a rotation period that's synchronous with the planet's rotation. If you do this right, you now have your object sitting at the right latitude.
3. Adjust the MeanLongitude of your object's orbit so that it sits at the correct planetary longitude.
4. Tweak your object's Orientation and RotationOffset so that it is correctly orientated relative to the surface of the planet.

As proof-of-concept, I've placed the 2001 Moonbus model (the only model I've got with landing legs) at the Apollo 17 landing site (the farthest from the Moon's equator). I've annotated the code so that you can see where all the numbers come from. (The hardest bit is adjusting the model orientation - the technique will vary from model to model, depending on how they are originally orientated on the X,Y,Z axes.)

Here's the code:

```
#To place a lander on the Moon at 20.18809N, 329.22525W and keep it there

#in this case, 1737.54 (lunar radius +10m)

"#" "Sol/Earth/Moon"         #A dummy body to provide a suitable orbit centre
{
EllipticalOrbit {
Period        1e12          #Effectively stationary
SemiMajorAxis   599.630455  #Desired radius * sin(Latitude)
AscendingNode    43         #Moon's RotationOffset
Inclination      90         #Polar orbit
MeanAnomaly      90         #Fixed on the lunar rotation axis
}
}

"Lander" "Sol/Earth/Moon/#"
{
Class "spacecraft"
Mesh "Moonbus.3ds"

EllipticalOrbit {
Period        27.321661         #Lunar rotation period
SemiMajorAxis   1630.793846     #Desired radius * cos(Latitude)

#Moon's RotationOffset =    +43
MeanLongitude   -286.22525      #Subtract west longitude = -329.22525
#                           =========
#                          -286.22525
}

#Latitude in x rotation
Orientation [20.18809 1 0 0]    #(This parameter will vary depending on the
# orientation of the specific model used)

#Re-orientation of model =      -90
#Moon's RotationOffset   =      +43
RotationOffset -16.22525    #Subtract west longitude =     -329.22525
#                               =========
#                              -376.22525

Albedo 0.80
}

```

Here's another example, placing a spacecraft near the surface of Eros:

```
#Latitude = -31.3
#Longitude = 134.4

"#" "Sol/Eros"         #A dummy body to provide a suitable orbit centre
{

EllipticalOrbit {
Period            1e12     #Effectively stationary
SemiMajorAxis    -2.857    #Desired radius * sin(Latitude)
AscendingNode   158.165    #Eros RotationOffset
Inclination      90        #Polar orbit
MeanAnomaly      90        #Fixed on Eros' rotation axis
}
}

"NEAR" "Sol/Eros/#"
{
Class "spacecraft"
Mesh "galileo.3ds"

EllipticalOrbit {
Period           0.21958333 #Eros' rotation period (in days)

SemiMajorAxis    4.699      #Desired radius * cos(Latitude)

#Eros' RotationOffset =            +158.165
MeanLongitude  203.765  #Subtract west longitude =         -134.4
#Add 180 to reorientate on 3ds =   +180
#                                   =======
#                                   203.765
}

Albedo 0.5
}

```