-
Notifications
You must be signed in to change notification settings - Fork 1
Description
A huge + to using a coordinate system is knowing what direction you are flying. But pulling this off is tricky.
We can represent a direction as a vector, and we can get this directional vector by subtracting our current coordinate from our previous coordinate. But this only gives us pitch and yaw information relative to the axes. Technically, this is enough to display a direction, but the rotation of the display depends on the ship's roll.
To calculate roll, I can think of 2 options:
- Calculate coordinates for a left and right edge of the ship to define a left-right axis. Then compare the rotation of this axis to the coordinate grid to get the roll. This method requires at least 2 independent coordinates.
- Assume the rotation based on change in direction combined with player input. If we store the previous directional vector and compare it with the current directional vector, we can get the change relative to the coordinate grid. From there we check the user's FCU input controls to see what they are pressing. With all that, we can assume the ship's rotation.
Option 1 is probably the cleanest, but requires at least 2 independently calculated coordinates. Since we would like the Module to be as accurate as possible, these would have to be quad coordinate systems, which is a lot of receivers. It would work, but the construction overhead is eh.
Option 2 would be the cleanest design-wise, but probably the most tricky and error prone. My instinct is the update speed may not be great either given the additional calculations and then tapping into the FCU values. But it could work.
TODO:
- Research options 1 vs 2 to see what the code and construction overhead of each would be.
- Brainstorm display options. How do you go about displaying direction with current control devices?
- Look at methods of comparing two directional vectors. Dot product with law of cosines?