本文整理汇总了C#中Vessel.GetOrbit方法的典型用法代码示例。如果您正苦于以下问题:C# Vessel.GetOrbit方法的具体用法?C# Vessel.GetOrbit怎么用?C# Vessel.GetOrbit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vessel
的用法示例。
在下文中一共展示了Vessel.GetOrbit方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: getVesselState
public json getVesselState(Vessel vessel)
{
Debug.Log ("STEP_XXX_1");
Orbit orbit = vessel.GetOrbit ();
//string referenceBody = FlightGlobals.Bodies.IndexOf (orbit.referenceBody).ToString ();
string referenceBody = orbit.referenceBody.GetName ();
//List<string> buffer = new List<string>();
json buffer = new json ();
buffer.Add ("type", "vessel");
if (vessel.situation == Vessel.Situations.LANDED) {
buffer.Add ("state", "landed");
}
else if (vessel.situation == Vessel.Situations.SPLASHED) {
buffer.Add ("state", "splashed");
}
else if (vessel.situation == Vessel.Situations.PRELAUNCH) {
buffer.Add ("state", "prelaunch");
}
else if (vessel.situation == Vessel.Situations.FLYING) {
buffer.Add ("state", "flying");
}
else if (vessel.situation == Vessel.Situations.ORBITING) {
buffer.Add ("state", "orbiting");
}
else if (vessel.situation == Vessel.Situations.DOCKED) {
buffer.Add ("state", "docked");
}
else if (vessel.situation == Vessel.Situations.SUB_ORBITAL) {
buffer.Add ("state", "suborbital");
}
else if (vessel.situation == Vessel.Situations.ESCAPING) {
buffer.Add ("state", "escaping");
}
else {
Debug.Log ("Unknown vessel situation");
buffer.Add ("state", "unknown");
} // # 1
Debug.Log ("STEP_XXX_2");
buffer.Add ("uid", vessel.id.ToString ());
buffer.Add ("name", vessel.vesselName); // # 3
buffer.Add ("ut", Planetarium.GetUniversalTime ()); // # 4
buffer.Add ("ref", referenceBody); // # 5
buffer.Add ("lon", vessel.longitude); // # 6
buffer.Add ("lat", vessel.latitude); // # 7
buffer.Add ("apo_t", vessel.orbit.timeToAp);
buffer.Add ("per_t", vessel.orbit.timeToPe);
// Why was this zero?
Vector3d r = orbit.getRelativePositionAtUT (Planetarium.GetUniversalTime ());
Vector3d v = orbit.getOrbitalVelocityAtUT (Planetarium.GetUniversalTime ());
//Vector3d r = orbit.pos.xzy;
//Vector3d v = orbit.vel.xzy;
List<double> RV = new List<double> ();
Debug.Log ("STEP_XXX_3");
// TODO explain the coordinate system further
RV.Add(r.y);
RV.Add(r.x);
RV.Add(r.z);
RV.Add(v.y);
RV.Add(v.x);
RV.Add(v.z);
buffer.Add ("rv", RV); // # 8
Vector3d forward = vessel.ReferenceTransform.forward;
Vector3d up = vessel.ReferenceTransform.up;
List<double> fwup = new List<double> ();
fwup.Add (forward.y);
fwup.Add (forward.x);
fwup.Add (forward.z);
fwup.Add (up.y);
fwup.Add (up.x);
fwup.Add (up.z);
Debug.Log ("STEP_XXX_4");
buffer.Add ("fwup", fwup);
//Debug.Log ("SPEED1: " + orbit.getOrbitalVelocityAtUT (Planetarium.GetUniversalTime ()).ToString ()); // Tis is currently used velocity
//Debug.Log ("SPEED2: " + orbit.GetFrameVelAtUT (Planetarium.GetUniversalTime ()).ToString ());
//Debug.Log ("SPEED3: " + orbit.GetRelativeVel ().ToString () );
// GetRelativeVel seems to be OK to get the correct position
//Debug.Log ("SPEED4: " + orbit.GetRotFrameVel ( ().ToString () );
//Debug.Log ("POSIT1: " + orbit.getPositionAtUT(Planetarium.GetUniversalTime ()).ToString ());
//Debug.Log ("POSIT2: " + orbit.getRelativePositionAtUT(Planetarium.GetUniversalTime ()).ToString ()); // Tis is currently used pos
//Debug.Log ("POSIT3: " + orbit.getTruePositionAtUT (Planetarium.GetUniversalTime ()).ToString ());
//Debug.Log ("POSIT4: " + orbit.pos.xzy.ToString ());
//Debug.Log ("FRAMEROT: " + Planetarium.FrameIsRotating ().ToString ());
//Debug.Log ("FRAMEROT: " + Planetarium.ZupRotation.ToString ());
//Debug.Log ("FRAMEROT: " + Planetarium.Rotation.ToString ());
//Debug.Log ("Framerot: " + Planetarium.InverseRotAngle.ToString ());
//.........这里部分代码省略.........