Jump to content

gomker

Members
  • Posts

    376
  • Joined

  • Last visited

Everything posted by gomker

  1. I see there is a Vessel.longitude / latitude but translating that back to a Vector3 for vessel position is the issue. Off to research more, I know someone has tackled this more than once
  2. Would a better approach be storing the Lat/Lon/Altitude? I think of how I can save coordinates with HyperEdit and send a vessel to those exact coordinates each time. Haven't found anything on that yet but was a thought.
  3. Hey there, good to see you back. I actually had the restore of position and velocity working somewhat well, but did not consider a few of the factors you mentioned. In my research though I have discovered more about setting the position and why there were inconsistent results http://forum.kerbalspaceprogram.com/index.php?/topic/84948-definition-of-vesselgetworldpos3d-seems-to-be-inconsistent/&do=findComment&comment=1410963 http://forum.kerbalspaceprogram.com/index.php?/topic/95305-transformposition-changes-after-revert-flight-to-launch/&do=findComment&comment=1631915 http://forum.kerbalspaceprogram.com/index.php?/topic/120884-vessel-rotations-and-planetary-location/ This one right on the money http://forum.kerbalspaceprogram.com/index.php?/topic/54014-vesselsetposition-issue/#comment-788113 The TLDR; version is vessel position isn't really the potion on the surface and other methods are relative to the Celestial bodies. I am mucking around with other ways of setting it up and almost have the VesselModule framework somewhat working. I'd love to collaborate if you like, having another set of eyes on this helps. Regards
  4. I think you and I are running into a similar issue. I am migrating to a VesselModule which has some different behavior and I am unsure on when the onGUI() fires for my menu for the toolbar. I assume there is different behavior in the editor than when in flight, but I have not found a reference for that describes the behavior, only things on PartModule and VesselModule.
  5. Do you mean the text of the field? I just run an update to the value in onFixedUpdate() to update my debug values I want to monitor in real time check in my PartModule. I should probably do a proper debug message, but I am just getting started and wanted immediate satisfaction [KSPField(isPersistant = true, guiActive = true] public string vesselSituation; public void FixedUpdate() { vesselSituation = vessel.situation.ToString(); } You can break things by putting in values that aren't text friendly, so careful on the types I trust no Quats ( now I need to go read up on what they are ) This sounds promising I will implement and see what happens. If I can get these values to persist per vessel correctly I can move on to fixing the position.
  6. Ah, learned something new. I saw some discussion around that topic , is using vessel.transform.position any better in this case? I see that comes back as a Vector3 and not Vector3d. I am also taking a crack at transforming this into a VesselModule, that update is here, but I seem to be running into the same issue of of values being shared. I've worked out how to save the data with this post Thanks
  7. Also just ran into an issue with switching vessels. Should the values be instanced per vessel, I am seeing some issues where they are not staying unique per vessel in game.
  8. I just discovered VesselModules and am trying to convert my part module and would very much like to use this. I have gotten a few steps in and wanted to see if this was still a valid approach as I try and roll it into my mod. I really only have a 3 or 4 values I need to persist. Do you have some examples of Saving and Loading using this method. I am a bit confused on how this will deal with data types, my values are boolean and Vector3 coordinates. Regards
  9. Update on that, I got the Chute to attach on Eject, but clicking it for deploy is pretty much impossible, for some reason KIS is not fully "creating" the chute. If I am on the ladder still I can click, but mid flight its hit or miss on if you can get the pop up to show. I would like to go back to creating the chute like mod did from scratch previously but that is a bit of coding.
  10. The people in the dev threads have been very helpful so far pointing out these interesting things. The others have also posted a wealth of examples so at least there are great starting points and its not a complete feel in the dark situation.
  11. I pushed my latest changes here The issues only manifests itself when both Vessels have the Part with the module on them. If one does not the values do not jump from vessel to vessel.
  12. @SpannerMonkey(smce) @Ser After extensive research and review of both the original code I believe I have tracked down the root cause of the problem. Its a good news / bad news situation. During the tests I found that several factors in conjunction trigger the problem Moving in and out physics range If the vessel you are moving into physics range with also has an Airpark module on it Most of my tests pre-release consisted of parking several boats, then using a plane (which did not have Airpark) to fly close to the parked boats, this did not trigger any issues. The root cause is because of the way part modules function, the code is designed to run in the "FixedUpdate()" which executes every frame to keep a vessel parked. This code executes every frame on Active and in-Active vessels alike. I can test for either Active or inactive however since the scope will always be the "part" as this is a Part Module. When the vessel moves into physics range it is overriding the "Position" value causing the vessels to jump. There may be another problem in the logic but in debug I can see the values being hijacked. The "good" news is that there may be a solution, using a Vessel Module instead of a Part Module. This seems to be more fitting of a module as it really should be scoped to the vessel. This will be a set of different challenges that will take some time to rewrite.
  13. @blowfish Thanks for tipping me on to that I found this , but it seems it wont completely solve my issue as I would like to save the state persistently I just started reading it though , there may be other ways. //Edit - If you want to see the full code you can peruse my attempts to fix in my branches here Thanks again!
  14. I did not know that was a thing, I am a bit new to all this, I didn't see anything like that in API docs - my class declaration is public class Airpark : PartModule
  15. Are values in KSPFields for a plugin instanced per vessel or shared somehow? I have an odd issue where I am recording the Vessel position as so [KSPField(isPersistant = true, guiActive = false)] Vector3 ParkPosition = new Vector3(0f, 0f, 0f); parkfunction() { // ParkPosition = vessel.GetWorldPos3D(); // } I have one vessel(A) parked at 3KM from airfield. I launch vessel(B) and approach. As soon as Vessel(B) comes into physics range of Vessel(A) the value for "ParkPostion" in Vessel(B) shows up for Vessel(B) I had some other code (I took over this project from another dev) that I think was supposed to record the position when saving public override void OnSave(ConfigNode node) { base.OnSave(node); if (vessel != null ){ ParkPosition = vessel.GetWorldPos3D(); } } It appears I am not storing the values correctly, but I am confused as to how a value seems to be jumping from vessel to vessel.
  16. There are some bugs right now in Airpark I am working on as I type this. Look for an update soon.
  17. I just saw that last night - I reverted my commit and still had it happening, it was driving me nuts. I think I narrowed it down to Vessel.Situation going from Prelaunch, to Flying. Once it was flying a bit further I could return. Now that I can reproduce I will debug the hell out if it. That math was in the starting fork, never thought to validate. if ((vessel.GetWorldPos3D() - FlightGlobals.ActiveVessel.GetWorldPos3D()).magnitude < 1500.0f && Parked) It is set to a double , so probably is off by a decimal place, I don't know what the "units" are for magnitude, I assume Meters. Agreed, I think the jumping around is due to two factors , something with coming off/on rails being called and what Park position is being "remembered". Values are not staying persistent and seems to only occur when coming into Physics range, which I assume calls vessel.GoOffRails() I was so close to getting the velocity restored, but I will jump back to this issue first.
  18. That was my bad - as SpannerMonkey was mentioning we are still tweaking the MM configs and I used a [waterjet*] @SpannerMonkey(smce) begs the question, how do we want to handle engines that are submerged?
  19. @Bitrefresh I am maintaining Airpark now here No need for KAS anymore, there is a surface attach part.
  20. @Ser Here is a first pass on the velocity restore if you would like to test - https://github.com/gomker/AirPark/tree/issue-1-velocityrestore
  21. Thanks very much, worked perfectly. I will have to keep on top of KIS updates I suppose and recompile as needed until I figure out my own way to spawn the item. public void GetKISInventory() { if (FlightGlobals.ActiveVessel.isEVA) { var kis = FlightGlobals.ActiveVessel.rootPart.FindModuleImplementing<ModuleKISInventory>(); //kis.items[0].Use(KIS_Item.UseFrom.InventoryShortcut); kis.items[0].Equip(); ChuteAdded = true; } }
  22. I understand this and will see about restoring the velocity however, there is a fundamental flaw in this logic. If I unpark the inactive vessel when you get in range it will not be controlled and fly away without an Autopilot. I was going to disable the 'Auto-Unpark' feature for vessels in flight as this doesn't seem to be something anyone would want unless it was an airship or boat. For clarity I am only talking about the "Auto-Unpark" , I understand the use case for returning velocity on manual un-park. Question on your testing. Did you use new vessels or ones that were already deployed. I ask because when I rebuilt there may have been an issue with the Vessel state not saving correctly that would cause the jumping around you reported. I took a video of what I thought you described for Test Case2 Regards,
  23. Clarification on this one, Auto-Park(which has been renamed auto-unpark) will unpark a vessel if parked and within 1.5 KM. As a test case what is the desired outcome? Other than not exploding of course , would you want the plane to un-park and continue on its velocity? If you didn't have something like BDArmory Autopilot enabled as well the plane would crash.
  24. @Ser @SpannerMonkey(smce) I think I may have gotten it worked out. I tested the following scenarios (all at same time and did save/reload a few more) Launched Aircraft , flew to about 1000M airparked. Went back to Space center, launched Aircraft, flew to same area, airparked - didn't detonate this time Launched Boat , placed in water 2 KM away, airparked - did this 2x more Switched between vessels all stayed parked Vessel creep seems to be gone as well Let me know if you are still seeing any issues and any test cases I may not have run against. Github is updated and so its Spacedock - .v0.1.5.2
  25. @SpannerMonkey(smce) That concurs from my observations as well and my understanding of Vessel states. The Vessel State is not going to affect the movement of the vessel, its just a "tag" for the game to understand where the vessel is in terms of Prelaunch -> Launch-> Flying etc... There will be no way to statically "freeze" something without constantly setting its position/velocity , and that is where dunclaw started off in his fork. @Ser Is there something I may have missed here in the logic that you can think of? I cannot see another way to code this at the moment. //edit Whoo boy, yeah I see those issues with flying - getting to work on trying to fix that now.
×
×
  • Create New...