/// <summary> /// Determine how many parents/grandparents etc. have Kepler mode. /// GE uses this to ensure evolution starts at the most central body in a heirarchy /// and works out to the leaves. /// </summary> public static int CalcKeplerDepth(IFixedOrbit fixedBody) { if (!fixedBody.IsOnRails()) { return(0); } int depth = 0; bool done = false; NBody center = fixedBody.GetCenterNBody(); while (!done && (center != null)) { IFixedOrbit parent = center.GetComponent <IFixedOrbit>(); if ((parent != null) && parent.IsOnRails()) { depth++; center = parent.GetCenterNBody(); } else { done = true; } } return(depth); }
public static bool IsOnRails(NBody nbody) { bool isOnRails = false; IFixedOrbit ifOrbit = nbody.GetComponent <IFixedOrbit>(); if (ifOrbit != null) { isOnRails = ifOrbit.IsOnRails(); } return(isOnRails); }