|
|
|
@ -101,11 +101,7 @@ void update_orbit_tracker(OrbitTracker* tracker, CelestialBody* body, CelestialB |
|
|
|
Mat3 rotation = mat3_rotation_orbital(tracker->argument_of_periapsis, |
|
|
|
Mat3 rotation = mat3_rotation_orbital(tracker->argument_of_periapsis, |
|
|
|
tracker->inclination, |
|
|
|
tracker->inclination, |
|
|
|
tracker->longitude_of_ascending_node); |
|
|
|
tracker->longitude_of_ascending_node); |
|
|
|
// Transpose to get inverse rotation (back to orbital plane)
|
|
|
|
Vec3 pos_orbital = mat3_multiply_vec3(mat3_transpose(rotation), relative_pos); |
|
|
|
Mat3 rotation_T = {rotation.m00, rotation.m10, rotation.m20, |
|
|
|
|
|
|
|
rotation.m01, rotation.m11, rotation.m21, |
|
|
|
|
|
|
|
rotation.m02, rotation.m12, rotation.m22}; |
|
|
|
|
|
|
|
Vec3 pos_orbital = mat3_multiply_vec3(rotation_T, relative_pos); |
|
|
|
|
|
|
|
current_angle = atan2(pos_orbital.y, pos_orbital.x); |
|
|
|
current_angle = atan2(pos_orbital.y, pos_orbital.x); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
current_angle = atan2(relative_pos.y, relative_pos.x); |
|
|
|
current_angle = atan2(relative_pos.y, relative_pos.x); |
|
|
|
|