LunaMultiplayer / TiltEm

Planetary axial tilt for KSP
MIT License
10 stars 3 forks source link

Latitude Error when Rotated Planetarium=False #19

Open Kerbinator-Fras opened 2 years ago

Kerbinator-Fras commented 2 years ago

When having one of my vessels orbiting equatorially for configured Uranus, the KER readout of latitude is always 0 which is correct (expected). However, on-rail setting tilt to false lead to problem, then the latitude will not be 0. (the vessel is on-rail, so there is no change in vessel orbit because of other possible bugs involve) For Saturn, Jupiter, this is negliable (not greater than 0.5deg); however it randomly distribules and make a 20deg peak for Uranus whose original inclination is close to 90 degrees. And I can sure it's not fault of KER readout, since the brown dot on Uranus north pole has changed its position. Note that at the beginning of KSP loading, the maximum latitude recorded is 22°7'46'' (or by pressing reset) KSP.log The TiltX and TiltZ are made based on there regular satelites' orbit (their orbit plane is almost same as planet equator, and I've got the equation of TiltX&TiltZ versus LAN&inclination of an Equatorial orbit. The data and formula are shown here (inclination shortened as i) sin(tiltZ)=sin(i)*sin(LAN), cos(tiltX)=cos(i)/cos(tiltZ) then use trial and error to determine whether this is an acute or obtuse angle, positive or negative angle and data gathered from this method

   @Body[Jupiter]
    {
        @Properties
        {
            tiltx = -1.90762
            tiltz = 0.829245
        }
    }
    @Body[Saturn]
    {
        @Properties
        {
            tiltx = 27.638
            tiltz = -4.6761
        }
    }
    @Body[Uranus]
    {
        @Properties
        {
            tiltx = -82.0191
            tiltz = 12.18444
        }
    }
Kerbinator-Fras commented 2 years ago

Another thing is, by watching the change of Skybox and detail of planet texture, now I know what you are doing: You've directly changed the view from General reference frame of KSP(SCI of Principia) to Planet-centered-Planet-fixed(xCxF of Principia) well I suggest you ease these bugs by converting to Planet-centered-inertial(xCI) coordinaties, a non-rotating xyz axes whose z axis pass planet north&south pole. now I can certainly tell that all the faults is caused by the switch to xCxF frame. use xCI frame instead, probably because rotating axes will cause troubles in orbit calculation which may explain the weird force when you are far from the planet, because at that time xCxF speed will be tremendous.

gavazquez commented 2 years ago

Hi @Kerbinator-CN at the moment I don't have much time to devote to open source (neither to LMP) but contact me on discord if you need help or want to contribute with code. To be honest I hardly remember what I did for this to make it "work"

Kerbinator-Fras commented 2 years ago

That's okay anyway, I'm not too anxious to do that (I have a stock mission overhead, and my proposal is on using it for RSS actually). For current situation, use these two files along with RSS 18.1.3

RSS with Tilts.zip

Data

Installation: install RSS 18.1.3, and replace RSSkopernicus with folder in zip file, install TIltEm and replace TiltEm.cfg with provided ones.

Note: Tilts of regular satelites (all satelites of Jupiter Saturn Uranus, except Iapetus) are same as their parent star. You may manually copy or (idk) use MM grammar to patch any of them who has referenceBody=J/S/U)

Solar Planets Orbital Elements: mean value over several periods Satelites Orbital Elements: inclination and LAN from 1950.1.1 (JD2433282.5) Tilts: Jupiter Saturn Uranus from their regular satelites used as equitorial LAN and inclination Moon Mercury Venus Neptune Pluto from IAU data (north pole) via some conversion in RSSkopernicus, the rotation period of Uranus, Pluto are also set to be negative. (also Venus, which is originally negative)

TO-DOs (simplified from that bunch of issues; and is much more feasible probably)

  1. option of tilted inertial space (for sake of easier orbital plotting, and a different camera view). invert rotation tilt is hidden to user or as a secondary test-only option. Then title of tilt being "tilted planetarium" instead of "Rotated planetarium". The inertial tilt is toggled at SOI entry or leaving. If best, make ship direction persistant during transition. This should fix engine shutdown issue.
  2. make harmony patch tilt correct for Uranus (Uranus tilt data entry I believe to be correct, as when rotated planetarium is true the latitude is 0°00'00" confirming it), and small errors of Jupiter and Saturn (about 1° latitude max error when rotated planetarium is false) Strange disclaimer: I didn't found things going wrong with Pluto which is also highly tilted. idk whether there's anything wrong.
  3. when one body's tilt is on, except the body itself, its Childrens should minus its tilt, while other objects add its tilt. Also, introduce true tidal locking so that tilt will not need to be duplicated into config. Children can be judged via referenceBody=xxxx chain. For now, Children's children can remain unconsidered if simply used for RSS (with Sun having no tilt); however it may be added later in releases) Note: even simply adding angles in spherical axes can be a great effort.

About documentation by using geometry softwares, result is tiltX is tied to the z-axis, tiltZ is tied to the rotation axis tiltZ is looking from Z+ to O, from the rotation axis to the rotation axis yz projection line tiltX forward is looking from X+ to O, from the rotation axis yz projection line to the z axis Counterclockwise is positive. This can be used for turning RA and Dec. into tilt data image (Example being Mercury) Write this into TiltEm wiki, thanks.

At last, thank you for giving us such wonderful mod for those who cannot afford lags of using Principia (or to get rid of station keeping). @gavazquez

Kerbinator-Fras commented 2 years ago

(by the way, I cannot find your discord account (I have one, though) You may tell me here

gavazquez commented 2 years ago

Sure, my discord: Dagger#1173