Hi everyone,
I am working on a spaceflight simulator. I am using existing visual platform, and have implemented Newton for spaceflight dynamics. So far, more or less, everything works. I have bodies in orbit, behaving like they should, and I can attach them to one another using a CustomHinge to create a rigid link (docked spaceship) between the bodies. The visual system I have renders the whole planet Earth and, using double precision versions of the libraries, I am able to model bodies in orbit around the Earth.
The problem is, the visual system has no provision for Earth rotation... Therefore, my bodies always track over the same trajectory on the surface. In real life, the Earth rotates and the bodies in orbit always track ahead (eastwards) by a certain amount (22.3 degrees longitude in the case of ISS). that's why the orbital paths look like sinusoidal curves horizontally (longitudinally) separated by a certain amount.
Since there is no provision to rotate the Earth, I have tried to solve this problem by introducing a small incremental rotation of all my objects in orbit, around the z-axis, (axis that in my coordinate system connects the Earth poles) opposite to the rotation of Earth, which would have the net effect of Earth rotating . This works fine for bodies that are not attached to each other or anything, but as soon as I attach 2 bodies, an instability occurs, and they start to wildly spin and rotate around each other. I am guessing that is because the bodies are now constrained to each other, and I am trying to apply positional changes (due to the rotation) separately to each one of them.
I know I shouldn't be applying positional changes directly to bodies (I should be applying only forces to the bodies and let solver take care of the positions and velocities) however, I am unsure how else to achieve the effect I need to get the Earth rotation working.
I have considered also calculating and adding a velocity vector that compensates for the Earth rotation, but that would definitely throw off orbital speeds (on equator, Earth spins at 1674 km/h).
Any idea on any better ways of accomplishing this? Thanks in advance!