Exemplo n.º 1
0
    private void UpdateTrajectory()
    {
        if (orbitalBody.CurrentGravitySource == null)
        {
            return;
        }

        trajectoryObject.transform.parent   = orbitalBody.CurrentGravitySource.transform;
        trajectoryObject.transform.position = trajectoryObject.transform.parent.position;
        if (orbitalBody.Trajectory.Eccentricity >= 1f)
        {
            trajectoryPlotter.BuildHyperbolicTrajectory(SemimajorAxis, SemiminorAxis, orbitalBody.Trajectory.Eccentricity, orbitalBody.Trajectory.ArgumentOfPeriapsis);
        }
        else
        {
            trajectoryPlotter.BuildEllipticalTrajectory(SemimajorAxis, SemiminorAxis, orbitalBody.Trajectory.Eccentricity, orbitalBody.Trajectory.ArgumentOfPeriapsis);
        }

        // Plot nearest intersections
        if (intersectionCalculator != null && orbitalBody is GravityAffected)
        {
            intersectionCalculator.PlotNearestSourceIntersections(orbitalBody);
        }
    }
Exemplo n.º 2
0
 private void UpdateIntersections(float timeToNode, Vector2 relativePosition, Vector2 relativeVelocity)
 {
     trajectorySolver.InitializeSolver(relativePosition, relativeVelocity, ship.CurrentGravitySource.Mass, trajectory);
     intersectionCalculator.PlotNearestSourceIntersections(ship, trajectorySolver.CalculatedPosition, trajectorySolver.CalculatedVelocity, timeToNode, trajectory);
 }