Ejemplo n.º 1
0
        protected override void content()
        {
            MarkerForces    comv = RCSBuildAid.VesselForces;
            MomentOfInertia moi  = comv.MoI;

            GUILayout.BeginHorizontal(GUI.skin.box);
            {
                GUILayout.BeginVertical();
                {
                    GUILayout.Label("MoI:");
                    GUILayout.Label("Ang Acc:");
                    GUILayout.Label("Ang Acc:");
                }
                GUILayout.EndVertical();
                GUILayout.BeginVertical();
                {
                    GUILayout.Label(moi.value.ToString("0.## tm²"));
                    float angAcc = comv.Torque().magnitude / moi.value;
                    GUILayout.Label(angAcc.ToString("0.## r/s²"));
                    GUILayout.Label((angAcc * Mathf.Rad2Deg).ToString("0.## °/s²"));
                }
                GUILayout.EndVertical();
            }
            GUILayout.EndHorizontal();
            DebugSettings.labelMagnitudes =
                GUILayout.Toggle(DebugSettings.labelMagnitudes, "Show vector magnitudes");
            DebugSettings.inFlightAngularInfo =
                GUILayout.Toggle(DebugSettings.inFlightAngularInfo, "In flight angular data");
            DebugSettings.startInOrbit =
                GUILayout.Toggle(DebugSettings.startInOrbit, "Launch in orbit");
        }
Ejemplo n.º 2
0
        void Awake()
        {
            /* layer change must be done before adding the Graphic components */
            GameObject obj = new GameObject("Translation Vector Object");

            obj.layer                   = gameObject.layer;
            obj.transform.parent        = transform;
            obj.transform.localPosition = Vector3.zero;
            transVector                 = obj.AddComponent <VectorGraphic> ();
            Color color = Color.green;

            color.a                      = 0.4f;
            transVector.color            = color;
            transVector.offset           = 0.6f;
            transVector.maxLength        = 3f;
            transVector.minLength        = 0.25f;
            transVector.maxWidth         = 0.16f;
            transVector.minWidth         = 0.05f;
            transVector.upperMagnitude   = 5;
            transVector.lowerMagnitude   = threshold;
            transVector.exponentialScale = true;

            obj                           = new GameObject("Torque Vector Object");
            obj.layer                     = gameObject.layer;
            obj.transform.parent          = transform;
            obj.transform.localPosition   = Vector3.zero;
            torqueVector                  = obj.AddComponent <VectorGraphic> ();
            color                         = XKCDColors.ReddishOrange;
            color.a                       = 0.6f;
            torqueVector.color            = color;
            torqueVector.offset           = 0.6f;
            torqueVector.maxLength        = 3f;
            torqueVector.minLength        = 0.25f;
            torqueVector.maxWidth         = 0.16f;
            torqueVector.minWidth         = 0.05f;
            torqueVector.upperMagnitude   = 5;
            torqueVector.lowerMagnitude   = threshold;
            torqueVector.exponentialScale = true;

            obj                         = new GameObject("Torque Circle Object");
            obj.layer                   = gameObject.layer;
            obj.transform.parent        = transform;
            obj.transform.localPosition = Vector3.zero;
            torqueCircle                = obj.AddComponent <CircularVectorGraphic> ();

            MoI = gameObject.AddComponent <MomentOfInertia> ();
        }
Ejemplo n.º 3
0
        void Awake()
        {
            /* layer change must be done before adding the Graphic components */
            transVector = getGameObject("Translation Vector Object").AddComponent <MarkerVectorGraphic> ();
            Color color = Color.green;

            color.a = 0.4f;
            transVector.setColor(color);

            torqueVector = getGameObject("Torque Vector Object").AddComponent <MarkerVectorGraphic> ();
            color        = XKCDColors.ReddishOrange;
            color.a      = 0.6f;
            torqueVector.setColor(color);

            torqueCircle = getGameObject("Torque Circle Object").AddComponent <CircularVectorGraphic> ();

            MoI = gameObject.AddComponent <MomentOfInertia> ();
        }
Ejemplo n.º 4
0
        void Awake()
        {
            /* layer change must be done before adding the Graphic components */
            transVector = getGameObject ("Translation Vector Object").AddComponent<MarkerVectorGraphic> ();
            Color color = Color.green;
            color.a = 0.4f;
            transVector.setColor(color);

            torqueVector = getGameObject ("Torque Vector Object").AddComponent<MarkerVectorGraphic> ();
            color = XKCDColors.ReddishOrange;
            color.a = 0.6f;
            torqueVector.setColor(color);

            torqueCircle = getGameObject ("Torque Circle Object").AddComponent<CircularVectorGraphic> ();

            MoI = gameObject.AddComponent<MomentOfInertia> ();

            Events.RootPartPicked += RootPartPicked;
            Events.RootPartDropped += RootPartDropped;
        }
Ejemplo n.º 5
0
        protected override void content()
        {
            MarkerForces    comv = RCSBuildAid.VesselForces;
            MomentOfInertia moi  = comv.MoI;

            GUILayout.BeginHorizontal(GUI.skin.box);
            {
                GUILayout.BeginVertical();
                {
                    GUILayout.Label("Mouse");
                    GUILayout.Label("MoI");
                    GUILayout.Label("Ang Acc");
                    GUILayout.Label("Ang Acc");
                }
                GUILayout.EndVertical();
                GUILayout.BeginVertical();
                {
                    GUILayout.Label($"{Input.mousePosition.x}, {Input.mousePosition.y}");
                    GUILayout.Label(moi.value.ToString("0.## tm²"));
                    float angAcc = comv.Torque().magnitude / moi.value;
                    GUILayout.Label(angAcc.ToString("0.## r/s²"));
                    GUILayout.Label((angAcc * Mathf.Rad2Deg).ToString("0.## °/s²"));
                }
                GUILayout.EndVertical();
            }
            GUILayout.EndHorizontal();

            Part part = null;

            if (massInfo)
            {
                foreach (var p in EditorLogic.fetch.ship.parts)
                {
                    if (p.stackIcon.Highlighted)
                    {
                        part = p;
                        break;
                    }
                }
            }
            if (massInfo)
            {
                if (part != null)
                {
                    GUILayout.BeginVertical(GUI.skin.box);
                    {
                        printMassInfo(part);
                    }
                    GUILayout.EndVertical();
                }
                else
                {
                    if (GUILayout.Button("mouseover a part"))
                    {
                        massInfo = !massInfo;
                    }
                }
            }
            else
            {
                if (GUILayout.Button("mass info"))
                {
                    massInfo = !massInfo;
                }
            }
            DebugSettings.labelMagnitudes =
                GUILayout.Toggle(DebugSettings.labelMagnitudes, "Show vector magnitudes");
            DebugSettings.inFlightAngularInfo =
                GUILayout.Toggle(DebugSettings.inFlightAngularInfo, "In flight angular data");
            DebugSettings.inFlightPartInfo =
                GUILayout.Toggle(DebugSettings.inFlightPartInfo, "In flight vessel tree");
            DebugSettings.startInOrbit =
                GUILayout.Toggle(DebugSettings.startInOrbit, "Launch in orbit");
            if (GUILayout.Button("Toggle vessel tree window"))
            {
                if (vesselTreeWindow == null)
                {
                    vesselTreeWindow = gameObject.AddComponent <DebugVesselTree> ();
                }
                else
                {
                    Destroy(vesselTreeWindow);
                }
            }
            if (GUILayout.Button("Toggle part list window"))
            {
                if (partListWindow == null)
                {
                    partListWindow = gameObject.AddComponent <DebugPartList> ();
                }
                else
                {
                    Destroy(partListWindow);
                }
            }
            if (GUILayout.Button("More info"))
            {
                if (debugMiscInfo == null)
                {
                    debugMiscInfo = gameObject.AddComponent <DebugMiscInfo> ();
                }
                else
                {
                    Destroy(debugMiscInfo);
                }
            }
        }