Ejemplo n.º 1
0
        void update()
        {
            if (TransferTime < 0)
            {
                TrajectoryCalculator.ClosestApproach(Orbit, TargetOrbit, StartUT, VSL.Geometry.MinDistance, out AtTargetUT);
                TransferTime = AtTargetUT - StartUT;
            }
            else
            {
                AtTargetUT = StartUT + TransferTime;
            }
            AtTargetPos      = Orbit.getRelativePositionAtUT(AtTargetUT);
            AtTargetVel      = Orbit.getOrbitalVelocityAtUT(AtTargetUT);
            TargetPos        = TargetOrbit.getRelativePositionAtUT(AtTargetUT);
            DistanceToTarget = Utils.ClampL((AtTargetPos - TargetPos).magnitude - VSL.Geometry.MinDistance, 0);
            DeltaTA          = Utils.ProjectionAngle(AtTargetPos, TargetPos,
                                                     Vector3d.Cross(Orbit.GetOrbitNormal(), AtTargetPos)) *
                               Math.Sign(TargetOrbit.period - OrigOrbit.period);
            DeltaFi = TrajectoryCalculator.RelativeInclination(Orbit, TargetPos);
            DeltaR  = Vector3d.Dot(TargetPos - AtTargetPos, AtTargetPos.normalized);
            var t_orbit = Target.GetOrbit();
            var t_vel   = t_orbit != null?t_orbit.getOrbitalVelocityAtUT(AtTargetUT) : Vector3d.zero;

            BrakeDeltaV   = t_vel - Orbit.getOrbitalVelocityAtUT(AtTargetUT);
            BrakeDuration = VSL.Engines.TTB((float)BrakeDeltaV.magnitude);
            KillerOrbit   = Orbit.PeR < MinPeR && Orbit.timeToPe < TransferTime;
//            Utils.Log("{}", this);//debug
        }
        void update()
        {
            if (TransferTime < 0)
            {
                TrajectoryCalculator.ClosestApproach(Orbit, TargetOrbit, StartUT, out AtTargetUT);
                TransferTime = AtTargetUT - StartUT;
            }
            else
            {
                AtTargetUT = StartUT + TransferTime;
            }
            AtTargetPos      = Orbit.getRelativePositionAtUT(AtTargetUT);
            AtTargetVel      = Orbit.getOrbitalVelocityAtUT(AtTargetUT);
            TargetPos        = TargetOrbit.getRelativePositionAtUT(AtTargetUT);
            DistanceToTarget = Utils.ClampL((AtTargetPos - TargetPos).magnitude - VSL.Geometry.R - TargetVessel.Radius(), 0);
            DeltaTA          = Utils.ProjectionAngle(AtTargetPos, TargetPos,
                                                     Vector3d.Cross(Orbit.GetOrbitNormal(), AtTargetPos)) *
                               Math.Sign(TargetOrbit.period - OrigOrbit.period);
            DeltaFi     = TrajectoryCalculator.RelativeInclination(Orbit, TargetPos);
            DeltaR      = Vector3d.Dot(TargetPos - AtTargetPos, AtTargetPos.normalized);
            KillerOrbit = Orbit.PeR < MinPeR && Orbit.timeToPe < TransferTime;
//			DebugUtils.Log("{}", this);//debug
        }