Gotbread

Members
  • Content Count

    12
  • Joined

  • Last visited

Community Reputation

6 Neutral

About Gotbread

  • Rank
    Bottle Rocketeer

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. So you mean you can already do this "trick" ? Does it work with this mod? So i just have to place my payload on the launcher stored in a subassembly and the mod will recognize it?
  2. Just to give you a quick feedback. I tested the mod on 1.2 and it works great! Will definitly become one of my standard mods for big savefiles! A small question/request though, would it be possible to be able to change the craft file afterwards? Say you have a Launcher capable of launching 100 tons to orbit and dock. The payload is contained in a fairing. If i want to change the payload i would change the ship. It would be awesome if you could fly the craft once with the maximum payload and from there on as long as the payload has less or equal mass (without reducing fuel or thrust) the ship would count as the same and allow you to send different payloads with one testflight. A very fine mod
  3. To put more fuel to the hype train, look at the new node systems. Not only stable as never but also predicting orbits ahead. Just beautiful http://i.imgur.com/F3LPVsL.png
  4. Yey, it is working! The transformation was indeed the issue!
  5. I'm currently trying to create a box from the raw vertices, and make this object visible in flight (map view, tracking view, normal view). Here is my code so far: using System; using System.Collections.Generic; using UnityEngine; namespace KSPPlugin { [KSPAddon(KSPAddon.Startup.EveryScene, false)] public class KSPPlugin : MonoBehaviour { private float last_time = 0.0f; private float interval = 5.0f; private GameObject testbox_obj = null; private MeshRenderer testbox_renderer = null; private MeshFilter testbox_filter = null; private const int MAP_LAYER = 10; private const int FLIGHT_LAYER = 15; void Awake() { } void Start() { Debug.Log("TEST ADD CUBE"); testbox_obj = new GameObject("testbox"); testbox_filter = testbox_obj.AddComponent<MeshFilter>(); Mesh mesh = testbox_filter.mesh = new Mesh(); testbox_renderer = testbox_obj.AddComponent<MeshRenderer>(); float length = 20f; float width = 20f; float height = 20f; #region Vertices Vector3 p0 = new Vector3(-length * .5f, -width * .5f, height * .5f); Vector3 p1 = new Vector3(length * .5f, -width * .5f, height * .5f); Vector3 p2 = new Vector3(length * .5f, -width * .5f, -height * .5f); Vector3 p3 = new Vector3(-length * .5f, -width * .5f, -height * .5f); Vector3 p4 = new Vector3(-length * .5f, width * .5f, height * .5f); Vector3 p5 = new Vector3(length * .5f, width * .5f, height * .5f); Vector3 p6 = new Vector3(length * .5f, width * .5f, -height * .5f); Vector3 p7 = new Vector3(-length * .5f, width * .5f, -height * .5f); Vector3[] vertices = new Vector3[] { p0, p1, p2, p3,// Bottom p7, p4, p0, p3,// Left p4, p5, p1, p0,// Front p6, p7, p3, p2,// Back p5, p6, p2, p1,// Right p7, p6, p5, p4// Top }; #endregion #region Color Color[] colors = new Color[] { Color.red, Color.red, Color.red, Color.red, Color.green, Color.green, Color.green, Color.green, Color.blue, Color.blue, Color.blue, Color.blue, Color.yellow, Color.yellow, Color.yellow, Color.yellow, Color.white, Color.white, Color.white, Color.white, Color.gray, Color.gray, Color.gray, Color.gray }; #endregion #region Normales Vector3 up = Vector3.up; Vector3 down = Vector3.down; Vector3 front = Vector3.forward; Vector3 back = Vector3.back; Vector3 left = Vector3.left; Vector3 right = Vector3.right; Vector3[] normales = new Vector3[] { down, down, down, down,// Bottom left, left, left, left,// Left front, front, front, front,// Front back, back, back, back,// Back right, right, right, right,// Right up, up, up, up// Top }; #endregion #region UVs Vector2 _00 = new Vector2(0f, 0f); Vector2 _10 = new Vector2(1f, 0f); Vector2 _01 = new Vector2(0f, 1f); Vector2 _11 = new Vector2(1f, 1f); Vector2[] uvs = new Vector2[] { _11, _01, _00, _10,// Bottom _11, _01, _00, _10,// Left _11, _01, _00, _10,// Front _11, _01, _00, _10,// Back _11, _01, _00, _10,// Right _11, _01, _00, _10,// Top }; #endregion #region Triangles int[] triangles = new int[] { // Bottom 3, 1, 0, 3, 2, 1, // Left 3 + 4 * 1, 1 + 4 * 1, 0 + 4 * 1, 3 + 4 * 1, 2 + 4 * 1, 1 + 4 * 1, // Front 3 + 4 * 2, 1 + 4 * 2, 0 + 4 * 2, 3 + 4 * 2, 2 + 4 * 2, 1 + 4 * 2, // Back 3 + 4 * 3, 1 + 4 * 3, 0 + 4 * 3, 3 + 4 * 3, 2 + 4 * 3, 1 + 4 * 3, // Right 3 + 4 * 4, 1 + 4 * 4, 0 + 4 * 4, 3 + 4 * 4, 2 + 4 * 4, 1 + 4 * 4, // Top 3 + 4 * 5, 1 + 4 * 5, 0 + 4 * 5, 3 + 4 * 5, 2 + 4 * 5, 1 + 4 * 5, }; #endregion mesh.name = "testbox"; mesh.vertices = vertices; mesh.normals = normales; mesh.uv = uvs; mesh.triangles = triangles; mesh.colors = colors; mesh.RecalculateBounds(); mesh.Optimize(); testbox_renderer.material = new Material(Shader.Find("Particles/Additive")); testbox_renderer.enabled = true; testbox_obj.SetActive(true); } void Update() { if (Time.time - last_time > interval) { last_time = Time.time; Debug.Log("Update. Is on map? " + MapView.MapIsEnabled.ToString()); } float scale = 1.0f; if (MapView.MapIsEnabled) scale = ScaledSpace.InverseScaleFactor; testbox_obj.layer = MapView.MapIsEnabled ? MAP_LAYER : FLIGHT_LAYER; testbox_obj.transform.position = FlightGlobals.ActiveVessel.GetWorldPos3D(); } void OnDestroy() { Destroy(testbox_filter); Destroy(testbox_renderer); Destroy(testbox_obj); } } } The final goal is to create a sphere (i started with a box because it's easier to debug), center it around a celestial body, and apply a custom shader to it. I dont see the object and i dont get any errors. How do i make the object visible?
  6. This is true. There is a fine line between adding a nice feature and annoying users. A workaround would be the following: Add a button to the function windows to "stick" the window to the screen. If a window sticks to the screen it will not close when you open another window, even if the new window contains the same function. This gives these use cases: Option1: Chain two functions: Open the first window with the first formula. Enter your values and click on the "stick" button. Now the window gets a unique title "window1" or "func1" for example. You can now move around this window and open the second one. The first window stays open and can now be referenced by its title, e.g. "func1.Ap" or "func1.velocity". Option2: Use the same function twice: There is no distinction between functions so you could open the same function twice. The first has to be sticked first but the second just functions normally (could be sticked too but does not need to). If you stick another one the new one gets an unique name as well, "func2" for example, Now you can grab func1.Pe and func2.Ap without ambiguity. Option3: Normal use without chaining: Just dont use the stick button. There will still be only one window and you do not have to close them. So in essence you have two kinds of windows. Sticky ones and nonsticky ones. The sticky ones just stay open and will get unique names. To close them you have to close them manually. The nonsticky ones work like they do now, so you can only have one of them, a newer one will close the old one. From a functionality perspective, yes. However, a scrolling log where you have to type everything is not too different from just writing a function, only that you do it piece by piece. You can combine this with a GUI to get the best of both worlds. By using windows you can arrange them on the screen as you like. Some intermediate values like periapsis can be kept visible and updated in real time (by using your auto-run-feature). And if you want to redo a calculation you dont have to press up in your history until you get the equation, rerun it, and repeat this for each equation. Having used Matlab its sometimes annoying to rerun a chain of >7 functions each time you do a change. If you use seperate windows however, all you need to do is click a few buttons in the right order, and you also have a visual indication which value needs to be updated. Even more comfortable, if you set each chained function to auto-rerun, the whole chain updates in realtime. This is something you do not get with a command line. I had no issues with the font, and scrolling zooms the ship is an issue every mod i used had, so no worries here. If you add another button (and you already have buttons, so that would be a minor rework) you would not have to deal with the editor widget mess of unity.
  7. I want to use the result of one function for the next one. I am aware that you can call functions within functions, but to do so you have to know in advance what you want to calculate. On some missions, i need to improvise or i dont want to plan too many steps ahead. Let my give you an example of the use cases: Lets say you have functions for the basic equations (vis viva and orbital period). For each function you have variations solved for each variable. For example one version of visviva gives you the speed based on altitude and sma. Another one gives you the altitude based on speed and sma. And you do this for each possible variable for each equation. This gives these 5 equations: 1) speed = f(altitude, sma) 2) altitude = f(speed, sma) 3) sma = f(speed, altitude) 4) period = f(sma) 5) sma = f(period) Also you make some helper functions to convert between sma and ap+pe representation (using the Parent.R global for convenience) 6) sma = f(ap, pe) 7) ap = f(sma, pe) 8) pe = f(sma, ap) Now you can combine the functions like lego pieces. For example you are on a hyperbolic trajectory around a planet and want to circularize at Pe. You now want to set up a node which does this for you. So you would calculate: - your current sma using equation 3 - your speed at Pe using equation 1 - your desired sma by using equation 6 with f(pe, pe) - your desired speed by using equation 1, this time with the desired sma - the difference of these speeds gives you your burn delta-v - and now you could create a node with that difference and with the time to Pe. You could write a function for this. But i like to do it step by step (before finding kerbulator i used a hand held calculator for this). A very convenient way of chaining these functions would be by storing their value in a global, or by making their result global (some double naming issues might arise here). Idealy you only have to click the run buttons for equation 3, 1, 6, 1 and fill in the values. You can already do so if you remember the values, for example calc function 1, remember or write down the value, use that as input to function 3, etc. But it would be nice if the kerbulator itself could store the values for you. It's not helpful to write every possible combinations of functions in advance because there are so many combinations. Want to circularize at Ap instead? Just call equation 6 but with f(Ap, Ap) instead of f(Pe, Pe). This is halfway there. You could write the use case above as: SetUpNode(Eta.Pe, VisVivaSpeed(Craft.Pe + Parent.R, VisVivaSma(Navball.OrbitalSpeed, Craft.Alt)) - VisVivaSpeed(Craft.Pe + Parent.R, SmaFromApPe(Craft.Pe, Craft.Pe)) But this is not very elegant and error prone. Also you might decide mid calculation that, lets say for a phasing orbit, your Pe is too low so you could redo the first steps and choose a better one. This would only be possible if you see the intermediate values. One big formula hides the details. How to improve this: When you click run on the function list, open the window for that function but dont close the last one, so you can have multible function windows open at once (i dont mean the permanent running displays, i mean the window with the function inputs and outputs). You give each window a name/title (to avoid naming issues and differentiate between sma from function 1 and sma from function 2), for example "func1", "func2", and so on Now you can use the values of one window as input for another window. Back to our use case from above: Run equation 3 from the function window. Enter Navball.OrbitSpeed and Craft.Alt as inputs. Hit run. Now you get your sma. Now run equation 1. But this time, enter Craft.Pe and func1.sma. The kerbulator now uses the output of function 1 as input for function 2, with ease for the user.
  8. I just found your mod, and installed it immediately! Really nice work. This is very handy to calculate resonant orbits for remotetech satellite constellations. However i missed a feature (maybe i just overlooked it): After running a function i would like to use the result in another function, by entering the variable name in the new function. Say for example i have a function GetSemimajorAxis. It's output is called "a". I run the function by hitting the run button and get the result. Now i have a function GetSpeedAtPeriapsis. It requires the semimajor axis, so i just want to hit the run button, and enter the variable name "a". But i can only have one open window for the functions, so the previous result is discarded. Remembering the value is not that comfortable. It would be really nice if the window just sticks around until i close it, and i could use the output values as inputs, but without nesting the functions, just by chaining them by hand.
  9. Hey guys i decided to try updating this mod to 1.1.3. Here are my results: Download KerbalGalaxy 1.1.3 (License, original mod from @TheJangleMan ) -Fixed some nonworking config parts. Now loads without errors -Removed Wormhole and big strange looking accretion disc -Fixed Pantagruel's mass, at this rotation rate it does not have enough gravity to support itself Also, since it does not made sense to me that big stars and even a black hole orbit the normal sun, i added a "Kerbol" star and reparented the kerbol system to it. Once this is done, the mass of the center core can be increased by a good amount to help for realism Download Kerbol System However, since this method reparents Kerbin, stuff is going to break. I got a KSC view which is not completely black, however once you lanuch anything, you get a NullReferenceException. Once this is fixed the rest works fine. And as a small advertisement, if i get the shader running in KSP, this could become possible! And for why the mod is loading slowly: It's textures are HUGE, so no surprise here.
  10. In this case, the Vis-viva equation is your friend. GM is known, r is your current distance to the center of the planet (in kerbins case, 100km + 600km = 700km). a is the semimajor axis, simply (ap+pe)/2. In this case, a becomes 1025km. Plugging this in gives an needed velocity of 2577.75 m/s. If you use the formula on your current orbit, you find your orbital speed to be 2246.13 m/s, so you need to burn 331.62 m/s prograde
  11. Hello fellow Kerbonauts! I have been playing with Kerbal Galaxy 2, but one thing really bugged me. Yeah, this thing This should be a black hole but... So i wrote something better Taking the Black hole Gargantua from the movie Interstellar as an example: This comes from a realtime relativistic raytracer. The path of the light is derived from the schwarzschild metric so this is as accurate as it can get. Here is the Source code and Executable for anyone interested. Be aware that this shader needs quite a powerfull graphics card to run in realtime. If your card struggles with this, just hold down CTRL while starting the executable. It will run in a smaller windowed mode which does not use as much resources as the fullscreen version. Controls are WASDE to move around, QE for up and down, RF to rotate the camera, Hold down SHIFT to increase moving speed. Hold down CTRL to increase moving speed more. Hold down SHIFT and CTRL to increase moving speed even more. And for the extra curious, press SPACE to shoot a colored ray from the cameras position. This ray will not be affected and shows the path though space (which is unphysical but helps to visualize). Full source code is attached, you need a C++ compiler and a DirectX sdk which includes DirectX11. The renderer uses a (procedural) spherical object which has a custom shader. This shader does the raytracing. The image is rendered into a offscreen buffer and used with a fullscreen effect shader to apply the bloom effect in a second pass. Now for the request part: I dont know enough about unity and C# to implement this myself. I saw Tuareg has written a Custom Shader Loader so this should in principle be possible. Ideally you would replace the black hole object in kerbal galaxy with a spherical dummy object and apply the provided shader to it. The second bloom-pass would be very nice, as it helps to underline the effect, but is not top priority. The whole thing is intended as an addon for kerbal galaxy, to get the improved effect while keeping the rest the same. I would also be thankful for any resources helping me to implement this, like how to create and use a shader in unity. License