Jump to content

[1.8.x+] Waypoint Manager [v2.8.1] [2019-10-22]


nightingale

Recommended Posts

Hmm i wonder if you can add a functionality to this addon:

Able to place a marker in the map view.

Example: i wanna place a marker where KSC is at.

That seems to be a fairly common request, although it's outside the scope of what I'd originally intended for this mod. Still, I may consider it for a near future version.

Yep, windowed mode. 1600x900 resolution. It might be best if you added something to let you move it around, perhaps a settings window or have a part of it you could click/drag to move around. :)

EDIT: Can't you query the window/screen dimensions and UI scale and use that to figure out where to put things? Something like:


// Pseudocode
Size size = Game.ScreenSize();
float uiScale = Game.UIScale();
int width = ___, height = ___;
int yCoord = ___;
drawUIAt((size.width() - uiScale * width) / 2, uiScale * yCoord, width * uiScale, height * uiScale);

Well, that's roughly what I tried to do, except I used screen resolution instead of window size, and then ignored uiScale. So yeah... needs work. :)

Link to comment
Share on other sites

Well, that's roughly what I tried to do, except I used screen resolution instead of window size, and then ignored uiScale. So yeah... needs work. :)

Hmm okay. I don't know C# (but do know C++/Java), but I think this may be your problem (line 220 of WaypointFlightRenderer.cs):

float ybase = Screen.currentResolution.height - Camera.main.ViewportToScreenPoint(asb.transform.position).y + 448;

448 pixels is an awfully long way to move that thing, especially when it's in completely the wrong direction :P

According to unity's documentation, in screen space (0,0) is the bottom left corner and (width,height) is the top right, so you want to do this:

float ybase = Camera.main.ViewportToScreenPoint(asb.transform.position).y - (some smaller number);

Hopefully that helps :) The number should be the size of the altimeter UI thingy + a little extra to leave a gap.

EDIT: To clarify, the idea is that the altimeter's position already takes screen height into account.

Edited by armagheddonsgw
Link to comment
Share on other sites

Hmm okay. I don't know C# (but do know C++/Java), but I think this may be your problem (line 220 of WaypointFlightRenderer.cs):

float ybase = Screen.currentResolution.height - Camera.main.ViewportToScreenPoint(asb.transform.position).y + 448;

448 pixels is an awfully long way to move that thing, especially when it's in completely the wrong direction :P

According to unity's documentation, in screen space (0,0) is the bottom left corner and (width,height) is the top right, so you want to do this:

float ybase = Camera.main.ViewportToScreenPoint(asb.transform.position).y - (some smaller number);

Hopefully that helps :) The number should be the size of the altimeter UI thingy + a little extra to leave a gap.

EDIT: To clarify, the idea is that the altimeter's position already takes screen height into account.

Unity is awesome and has a bunch of different coordinate systems. For GUI, the origin is top left. For viewport, the origin is bottom left. I thought the transforms were in viewport coordinates, but changing the resolution seems to throw it off - so obviously wrong. I knew the 448 was wrong - but didn't think it'd break under different resolutions. Still haven't found a way to programmatically get the height of the altimeter - that'll solve 90% of my problems. Basically what I need to be able to get is:

1) The altimeter height (in pixels)

2) The altimeter location/offset in GUI coordinates (ie. pixels).

As far as the offset goes, the transform has it as -0.2 when it's unexpanded, 0.3 when it's one button displayed, and 0.7 when it's two buttons displayed. I really don't know what to do to make those numbers into something sensible. :( Oh and this is all in the z coordinate, which makes even less sense.

UUUUNITTTTTTTY!!!!! :(

EDIT: Really, this should be super simple. Y offset of altimeter + height of altimeter + small y offset. Done.

Link to comment
Share on other sites

I thought the transforms were in viewport coordinates, but changing the resolution seems to throw it off - so obviously wrong.

Nah, they'll be in "world" coordinates of some kind. Usually the conversion to viewport (also culling) coordinates is done using the perspective transform (applied gpu-side by shaders). I should probably have realized the GUI coordinates would use (0,0) as top left :confused:.

As far as the offset goes, the transform has it as -0.2 when it's unexpanded, 0.3 when it's one button displayed, and 0.7 when it's two buttons displayed. I really don't know what to do to make those numbers into something sensible. :( Oh and this is all in the z coordinate, which makes even less sense.

That sounds like the "transform" might just be a variable inherited from a base class that's not actually used, and I'm sure you know what happens when you use those :P. Have you tried just having "float ybase = 150" or so? That is, a fixed value? You could always just scale it based on the UI scale setting. I'm struggling to find any documentation at all on AltimeterSliderButtons :(

Link to comment
Share on other sites

Nah, they'll be in "world" coordinates of some kind. Usually the conversion to viewport (also culling) coordinates is done using the perspective transform (applied gpu-side by shaders). I should probably have realized the GUI coordinates would use (0,0) as top left :confused:.

That sounds like the "transform" might just be a variable inherited from a base class that's not actually used, and I'm sure you know what happens when you use those :P. Have you tried just having "float ybase = 150" or so? That is, a fixed value? You could always just scale it based on the UI scale setting. I'm struggling to find any documentation at all on AltimeterSliderButtons :(

The last version had it as ybase = 80, and that worked well enough - the text just didn't move when the altimeter "slides down" to display the return to space center and recovery buttons. In an attempt to fix that, I've mostly messed it up. I may just give up and live with the text covering the altimeter occasionally.... It's not like anybody had complained about that yet. :)

Link to comment
Share on other sites

The last version had it as ybase = 80, and that worked well enough - the text just didn't move when the altimeter "slides down" to display the return to space center and recovery buttons. In an attempt to fix that, I've mostly messed it up. I may just give up and live with the text covering the altimeter occasionally.... It's not like anybody had complained about that yet. :)

You could just move it far enough down the screen that even with the altimeter fully extended, it doesn't overlap. :P

But then it might overlap the yellow popup text for timewarp and entering/exiting zones and so on....

Link to comment
Share on other sites

You could just move it far enough down the screen that even with the altimeter fully extended, it doesn't overlap. :P

But then it might overlap the yellow popup text for timewarp and entering/exiting zones and so on....

True - but I'd rather have it look good for the normal case - having it so low may look odd. Anyway.... I've thought of another approach to try.... But won't get a chance until a bit later.

Link to comment
Share on other sites

That seems to be a fairly common request, although it's outside the scope of what I'd originally intended for this mod. Still, I may consider it for a near future version.

Thank you for your consideration.

Here's a +1

Link to comment
Share on other sites

Hmm i wonder if you can add a functionality to this addon:

Able to place a marker in the map view.

Example: i wanna place a marker where KSC is at.

That would be very useful. In the meantime you can make a tiny useless rover named "KSC Beacon", and move it off the runway/launch pad and simply target it as you would any other ship (as long as you've unlocked targeting of course).

Link to comment
Share on other sites

If you could solve the traveling salesman problem, you are epic!

Since this is a huge problem, good luck!

I can solve it easy. Try all combinations, take the one with lowest cost. Done!

... oh, you wanted a solution with some level of time/space efficiency?

Link to comment
Share on other sites

Looks like your mod has been spotlighted by the KSP community on Facebook and Twitter.

Welcome Modding Monday-ers... good think I'm so very close to getting the text placement issue fixed.

- - - Updated - - -

In-Flight Waypoints 1.2.4 is out! Download it now!

Changes:

- Fixed issue with ETA for large distances.

- Fixed text positioning to work correctly (or nearly correctly) across all resolutions and UI sizes.

Edited by nightingale
1.2.4
Link to comment
Share on other sites

What a brilliant mod :) downloaded it :)

One quick ask/favour since this mod is still being updated very frequently, is it possible you could put it on curse or kerbalstuff that way we get an email when the author of said awesome mod updates it ;):)

Link to comment
Share on other sites

True - but I'd rather have it look good for the normal case - having it so low may look odd. Anyway.... I've thought of another approach to try.... But won't get a chance until a bit later.

Just a suggestion, look at how Kerbal Engineer Redux does its HUD implementation. It is fully configurable and allows you to re-position the HUD wherever you want it, enable/disable background, and pick and choose what information you do/don't want to see.

That may be more development than you are willing to take on for a simple mod like this, but I just wanted to point out that you will never find one place on the screen that will please everyone (for example, I place Blizzy's Toolbar right where In-Flight Waypoints 1.2.4's text appears).

Also a small feature request if possible: Along with the Distance and ETA, could you add Heading to the currently selected waypoint. I generally use MechJeb's Smart A.S.S. or Spaceplane Guidance to lock in my heading, and it would save me from having to estimate the heading from the Navball and then making adjustments to get it just right.

Link to comment
Share on other sites

What a brilliant mod :) downloaded it :)

One quick ask/favour since this mod is still being updated very frequently, is it possible you could put it on curse or kerbalstuff that way we get an email when the author of said awesome mod updates it ;):)

I'll consider it, but I'm not a huge fan of hosting in multiple places (more work for me). However there are two mods/systems that I highly recommend and support:

1) KSP-AVC - This will automatically check for new versions of mods whenever you start up KSP.

2) CKAN - This system will auto install mods and their dependencies with just a few commands.

Edited by nightingale
Prettify links
Link to comment
Share on other sites

Just a suggestion, look at how Kerbal Engineer Redux does its HUD implementation. It is fully configurable and allows you to re-position the HUD wherever you want it, enable/disable background, and pick and choose what information you do/don't want to see.

That may be more development than you are willing to take on for a simple mod like this, but I just wanted to point out that you will never find one place on the screen that will please everyone (for example, I place Blizzy's Toolbar right where In-Flight Waypoints 1.2.4's text appears).

Yeah, it was meant to be a quick & dirty display - I didn't want it to be in a window for just the one piece of information. I may just leave it as is, but give a config-file option for a couple set spots (left, middle, right, off). The KER example is a bit heavy - although you'll notice I made it to match the KER 1.0 always-up displays...

Also a small feature request if possible: Along with the Distance and ETA, could you add Heading to the currently selected waypoint. I generally use MechJeb's Smart A.S.S. or Spaceplane Guidance to lock in my heading, and it would save me from having to estimate the heading from the Navball and then making adjustments to get it just right.

Reasonable request. I'll look into this one for the next release.

Link to comment
Share on other sites

...Reasonable request. I'll look into this one for the next release.

You know what you're doing chap but if you don't want to re-invent the wheel, Kerbal Konstructs' Nav Guidance System does what you need. Feel free to save some time and use the code from that. https://github.com/AlphaAsh/Kerbal-Konstructs. Look in /src/UI/EditorGUI.cs.

Edited by AlphaAsh
Link to comment
Share on other sites

This. Mod. Is. AWESOME! I spent a couple hours worth of real-time in the first week after 0.90 dropped trying to complete a series of survey contracts on Minmus. This would've made that process so much simpler. So here, have some rep!

Link to comment
Share on other sites

You know what you're doing chap but if you don't want to re-invent the wheel, Kerbal Konstructs' Nav Guidance System does what you need. Feel free to save some time and use the code from that. https://github.com/AlphaAsh/Kerbal-Konstructs. Look in /src/UI/EditorGUI.cs.

I'd argue that knowing what you're doing means not re-inventing the wheel! :D

Thanks for this, I'll go have a look!

Link to comment
Share on other sites

2) CKAN - This system will auto install mods and their dependencies with just a few commands.

http://forum.kerbalspaceprogram.com/threads/100067-The-Comprehensive-Kerbal-Archive-Network-%28CKAN%29-Package-Manager-v1-5-0-24-Dec-2014

100% agree. If you're not using CKAN, you're doing it wrong.

Edited by godefroi
It is actually available...
Link to comment
Share on other sites

Yeah, it was meant to be a quick & dirty display - I didn't want it to be in a window for just the one piece of information.
That is what I figured. In that case, I do think the current position is the best. So unless you get requests from someone else to re-position it, don't waste the dev time on the config file for me. Also, I did notice how the readout appearance was similar to KER. Really clean and professional.
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...