Jump to content

Xavier513

Members
  • Posts

    66
  • Joined

  • Last visited

Everything posted by Xavier513

  1. Try this: global::Vessel v = FlightGlobals.ActiveVessel; v.ActionGroups.SetGroup(KSPActionGroup.Brakes, true);
  2. In game, we can enable "infinity fuel" in debug console. How can I do the same thing in a C# plugin? Is there any API?
  3. Environment: RSS, RO Sometimes after loading a saved game, I found the rocket standing alone on the ground, without launch pad and any other buildings around. Here's how to reproduce: 1, Enter VAB, launch a vessel. 2, After the vessel is loaded, save current name to save "A". 3, Press ESC, and enter Tracking Station, then change launch site to another location, then click "Exit" on the top right corner. 4, Press ESC, load saved game "A". 5, When the vessel is loaded, the launch pad is missing! Is this a bug of KSP or any mod? Is there any way I can fix it by myself? I'm working on a plugin. I'm using "GamePersistence.LoadGame()" to load saves, is there any C# API can fix this? Thanks very much!
  4. What kind of addon are you up to develop? I'm very curious, it sounds interesting.
  5. I think it's possible, an add-on/plugin is just some C# code running in an Unity engine. You can try doing following things to find the answer by yourself. Write a simple plugin to: upload a file to a local file server download a webpage, e.g. google.com send a get/post request to any website, e.g. google.com I guess the final answer is YES.
  6. Thanks! A further question: what happens when target vessel is very close to player vessel? If target vessel's position is determined by SetPosition (or "on-rails"), when player vessel collides with target, the target vessel would behave like a kinematic object, and it's orbit wouldn't change, which is not correct. But if target vessel is "off-rails" and throwed back to physics engine, I think it's not an easy thing to make target vessel to exactly move along it's orbit. When target vessel is far away and goes "on-rails" again, this inaccuracy will result in an orbit change, even if target vessel is not touched at all. How does KSP deal with this situation? Here is my thoughts: 1, When target vessel is near, target vessel goes "off-rails" and is throwed back to physics simulation. 2, If target vessel does not collide with any object, it finally moves far away enough and goes "on-rails", it's orbit would not change. The inaccuracy in physics simulation takes no effects to actual orbit. 3, If target vessel collides with something, from this moment on, its current physics state would result in an orbit change accordingly, until it moves far away and goes "on-rails" again.
  7. OK, after some tests, observing: Debug.LogWarning(Krakensbane.GetFrameVelocity() + "," + Krakensbane.GetLastCorrection()); these two values seems changing every Update.
  8. I'm working on a mod, related with things like rendezvous and some orbit calculation. I keep hearing about "Krakensbane", and I know it's for dealing with issues caused by high velocity, it's repositioning the whole universe. I'm curious on some details, so I searched the forum and found a link: http://forum.kerbalspaceprogram.com/entries/12-Krakensbane Unfortunately, it's not available anymore. Does anyone have a backup to that page? These are the questions I'm curious about: 1, When player vessel is coasting along orbit (at high speed, no timewarp), is the whole universe repositioning itself along player vessel's orbit, in "on rails" mode? 2, As the orbit is not a straight line, orbit velocity is changing all the time(both direction and speed), is the velocity absorbed by Krakensbane actually changing all the time? 3, If player vessel is accelerating, how often is the extra velocity absorbed by Krakensbane? Every FixedUpdate? 4, If another vessel is now very close to player(say, 100m), how is the vessel's position determined? By "on rail" mode(Deterministic Physics) or "off rail" mode(Physics engine)? Thanks!
  9. Newly downloaded [email protected], with two expansions, but with no mods. Quite simple to reproduce this bug: 1, load any save 2, press "ESC" 3, press "F2" (hide GUI) 4, press "ESC", again 5, load any save, again 6, BOOM! Now, KSP will load forever. But if you press "ESC", the GUI will show up, but the vessel disappears. The only way to recover is quit and launch KSP, again. Exceptions in KSP.log: [EXC 13:27:38.029] NullReferenceException FlightCamera.SetTarget (UnityEngine.Transform tgt, System.Boolean keepWorldPos, FlightCamera+TargetMode targetMode) (at <a5c262f7fe724eb9918d4487db8b635e>:0) FlightCamera.SetTarget (UnityEngine.Transform tgt, FlightCamera+TargetMode targetMode) (at <a5c262f7fe724eb9918d4487db8b635e>:0) FlightCamera.SetTargetVessel (Vessel vessel) (at <a5c262f7fe724eb9918d4487db8b635e>:0) FlightCamera+<Startup>d__67.MoveNext () (at <a5c262f7fe724eb9918d4487db8b635e>:0) UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at <12e76cd50cc64cf19e759e981cb725af>:0) [EXC 13:27:38.033] NullReferenceException UnityEngine.Transform.get_position () (at <12e76cd50cc64cf19e759e981cb725af>:0) FlightCamera.UpdateCameraTransform () (at <a5c262f7fe724eb9918d4487db8b635e>:0) FlightCamera.LateUpdate () (at <a5c262f7fe724eb9918d4487db8b635e>:0)
  10. "What country do you live in?" No China?
  11. It WORKS! Thank you! @si2504 With some minor changes though, appending following config node in "RealismOverhaul\Engine_Configs\EngineVariants_Config.cfg": @PART[*]:FOR[RealismOverhaulEnginesPost] { @MODULE[ModuleEngineConfigs] { @CONFIG,* { @minThrust = 0 } } }
  12. Hi, how can I change "Min Throttle" to all engines to "0%"? I have already set "simulateUllage" and "limitedIgnitions" in RealSettings.cfg to false, this is the last "stocklike" thing I need in RSS.
  13. Having the same issue, should I take this as a KSP bug? I'm going to swap them to each other in my code.
  14. Please help! KSP gets stucked whiling loading "proceduralSRBRealFuels". With [email protected] installed, I tested against multi versions of procedural parts, it seems this happens when ProceduralParts version 2.1.1 or 2.1.2 is installed. There may be something in version 2.1.1.
  15. hi, @Stone Blue, thanks. Sorry, I'm testing this function along with many other WIP features in my project, so it's not quite convenient to provide a DLL. But the codes above are basicly all the codes needed for this feature, for now. You can 1, create a new project in Visual Studio, 2, create a C# file with those codes. 3, add references of Assembly-CSharp.dll and UnityEngine.dll to project. 4, then you can compile it to generate a DLL, Besides, you have to add a button somewhere(e.g. some part's right click menu) to set "bottonClicked" to true, or activate the addon in other ways.
  16. OK, my mistake, some lines of code weren't commented out correctly. The code above works fine, now.
  17. I'm trying to play KSP on more than one monitor, with different content in each monitor. I successfully achieved this on two monitors, but I encountered an issue, and I need some help: the vessel disappears in the first monitor. This is how I enable the second monitor: 1, Connect another monitor to the PC running KSP (via HDMI port). 2, Compile following codes and start KSP, this addon will take effect in Flight scene. [KSPAddon(KSPAddon.Startup.Flight, false)] public class DisplayAddon : MonoBehaviour { private static bool bottonClicked; private static global::Vessel vessel; private static Camera galaxyCamera; private static Camera scaledSpaceCamera; private static Camera camera00; private static int SecondDisplay = 1; public void Start() { vessel = FlightGlobals.ActiveVessel; Display.displays[SecondDisplay].Activate(); // Activate the second display // Copy in-game cameras galaxyCamera = new GameObject().AddComponent<Camera>(); galaxyCamera.CopyFrom(Camera.allCameras.FirstOrDefault(cam => cam.name == "GalaxyCamera")); galaxyCamera.name = "GalaxyCameraCopy"; scaledSpaceCamera = new GameObject().AddComponent<Camera>(); scaledSpaceCamera.CopyFrom(Camera.allCameras.FirstOrDefault(cam => cam.name == "Camera ScaledSpace")); scaledSpaceCamera.name = "scaledSpaceCameraCopy"; camera00 = new GameObject().AddComponent<Camera>(); camera00.CopyFrom(Camera.allCameras.FirstOrDefault(cam => cam.name == "Camera 00")); camera00.name = "camera00Copy"; // New cameras render to the second display galaxyCamera.targetDisplay = SecondDisplay; scaledSpaceCamera.targetDisplay = SecondDisplay; camera00.targetDisplay = SecondDisplay; } public void FixedUpdate() { if (bottonClicked) { camera00.transform.position = new Vector3(-5.5f, 0.7f, -2.0f); // Place the camera at somewhere near the vessel camera00.transform.LookAt(vessel.CoM); galaxyCamera.transform.rotation = camera00.transform.rotation; scaledSpaceCamera.transform.rotation = camera00.transform.rotation; } } } 3, Load a save, load a vessel, then enable addon. Please take a look at these 4 images: https://imgur.com/a/uiOz9pn The first 2 images are contents in two monitors when the addon IS NOT activated. The last 2 images are contents in two monitors when the addon IS activated. As you can see, in the third image, the vessel is not shown. Does anyone know how to fix this? Thanks a lot!
  18. OK, it's "FlightCamera.fetch.Distance" and "FlightCamera.fetch.SetDistanceImmediate( )"
  19. When I scroll the mouse wheel in Flight scene, the camera will zoom in or zoom out. Which field in Camera(or FlightCamera) object is changing? How can I zoom in/out with code as if I'm scrolling the wheel? It doesn't seem to be the "fov"(field of view) field, on the basis of my test results.
  20. After some learning and testing, following codes can do the trick: FlightCamera.fetch.SetFoV(50); Camera.main.nearClipPlane = 0.1f; FlightCamera.fetch.SetTarget(null); GameObject parent = new GameObject("parent"); FlightCamera.fetch.transform.parent = parent.transform; Part p = ... // any part in the vessel parent.transform.position = p.transform.position + p.transform.rotation * new Vector3(offsetX, offsetY, offsetZ); parent.transform.rotation = Quaternion.AngleAxis(offsetDegree, engine.transform.right) * Quaternion.LookRotation(-p.transform.up, -p.transform.forward); // this is the correct rotation for engine parts It simply changes position and rotation of player's camera. But the camera seems to rotate around an point at about 75 units far, still don't know how to change that point and make it closer
  21. I'm trying to create a mod to use any part in a vessel as a camera. With this mod, I can view from any part in a more realistic way, without any new camera parts. For example, I can view from the bottom of engines, or view from pods in forward direction, or view from the top edge of fuel tanks(so I can see booster seperation). But I'm not familiar with either manipulating cameras or Unity engine, so I'm not quite sure about how to achieve this. My thoughts about this mod are: 1, Add a button in the right-click menu of each part. 2, If the button is clicked, the mod will create a new Camera object for this part. 3, Init the Camera object with the part's orientation(position + rotation), and some offsets. 4, Activate the new Camera, and view from it. I have to figure out how to implement each step, but the first question is, am I right about those steps? If I'm wrong, what is the right way to do that? Thanks!
  22. Thanks, problem solved. But I should look for remaining ignitions from "ModuleEnginesRF", not "ModuleEngines".
  23. Hi, how to get the amount of remaining ignitions? I tried this, but the the number doesn't change if the engine is turned on and off: ModuleEngineConfigs engineConfigs = p.GetModule<ModuleEngineConfigs>(); if (engineConfigs!=null) { Debug.LogWarning("engine ignition:"+ engineConfigs.config.GetValue("ignitions")); }
  24. Experincing same issue here, stock game, without any mods.
×
×
  • Create New...