Skip to content

Commit

Permalink
Fixed a bug that set planet positions with elevation angle of 90 to NAN
Browse files Browse the repository at this point in the history
  • Loading branch information
thorwin99 committed Feb 12, 2023
1 parent 8899024 commit 95b9d90
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ protected void SetOrbitProperties()
}

double elevation = MathHelperD.ToDegrees(Math.Asin(parentRel.Z / radius));
double orbitPos = MathHelperD.ToDegrees(Math.Acos(parentRel.X / Math.Cos(MathHelperD.ToRadians(elevation)) / radius));
double orbitPos = elevation == 90 ? 0 : MathHelperD.ToDegrees(Math.Acos(parentRel.X / Math.Cos(MathHelperD.ToRadians(elevation)) / radius));
if (parentRel.Y < 0)
{
orbitPos = 360 - orbitPos;
Expand Down

0 comments on commit 95b9d90

Please sign in to comment.