Jump to content

[0.90] v1.5 Analog Control - Fly smoothly with keyboard and mouse


Crzyrndm

Recommended Posts

All my minor mods are going into a single thread post-1.0 release. Please check my signature for the new thread

This plugin brings a common flight sim feature to KSP. A way to use your mouse to control your vessel for those who don't use gamepads and/or joysticks.

When activated, pitch and roll control inputs are the result of the position of the cursor onscreen. There's a deadzone along the center of each axis past which inputs scale towards the screen edges (reaching maximum 2/3rds of the way to the edge). Keyboard pitch/roll input is ignored while it's active.

Control is much more intuitive with the camera set to chase mode :wink:

Download

Instructions for use:

  1. ​Press the Enter/Return key to make the UI visible (control remains w/e you were using without this mod)
  2. Click the Left Mouse Button to activate mouse control
    • Tab key allows switching between roll (default) and yaw control. This can be changed at any time and is persistent through a flight, but the only indication of the current mode is the control behaviour :wink:

[*]Click again to pause mouse control (control output will remain as it was when you pause)

[*]Press Enter/Return key to regain control through other flight inputs.

Configuration file for x/y <range/deadzone/position>, and target transparency is generated upon leaving the flight scene. Changes made should be loaded upon re-entering flight (no need to restart).

Distributed under CC BY-NC-SA 4.0 license


v1.5
* Added two stage activation when the setting centerlineVisible is true.
* Added control pause (holds output state)
* Added pause location indication

v 1.4
* Added settings for center location
* Fixed center not being correctly accounted for
* Center is now trimmed

v 1.3
* Added settings for range and deadzone

v1.2
* Added invert pitch axis option
* Added optional HUD target to indicate location of deadzones. Transparency configurable
* .version file
* No longer a part module (why it ever was, I don't know)

v1.1
* Control input scaling changed to quadratic relationship with displacement for better fine control
* Changed activation key from numpad enter to standard enter/return key
* Added yaw control mode, switch between roll and yaw control using the tab key

Edited by Crzyrndm
Link to comment
Share on other sites

Does toggling "Fine control" with tabs lock help at all with that "extreme"ness? or does it apply the same strength (to put it some way)? I'm almost tempted to get this just because all of my planes always look like they are getting punched every time I try to turn or roll or whatever, the motion is so jerky and so wrong looking lol. This thing looks like the next best thing after a Joystick if you wanna get fluid motion.

Link to comment
Share on other sites

This looks awesome, I've been wanting this option for years! Two things though: one, would it be possible to make this activated by something not on the numpad? My laptop doesn't have one. And two: there should be a way to invert the y axis so it matches up with joysticks (and the mouse control option of other flight simulators).

Link to comment
Share on other sites

Does toggling "Fine control" with tabs lock help at all with that "extreme"ness? or does it apply the same strength (to put it some way)? I'm almost tempted to get this just because all of my planes always look like they are getting punched every time I try to turn or roll or whatever, the motion is so jerky and so wrong looking lol. This thing looks like the next best thing after a Joystick if you wanna get fluid motion.

As it stands, no it totally overrides the stock input functionality on the axes it controls. I have hardcoded sensitivity options for testing, but the need wasn't there for ingame adjustment (it is fairly high on the list of improvements...)

This looks awesome, I've been wanting this option for years! Two things though: one, would it be possible to make this activated by something not on the numpad? My laptop doesn't have one. And two: there should be a way to invert the y axis so it matches up with joysticks (and the mouse control option of other flight simulators).

Any suggestion for a better key choice? Numpad is nice because it doesn't get much use, but I forgot about laptops :(.

RE: all the other stuff

Sensitivity, axis inversion, yaw/roll switching (for flying planes and rockets), X/Y RCS control. All are on the list for possible expanded control features.

Link to comment
Share on other sites

Updated to v1.1 to fix a few of the more pressing problems.

Control is significantly smoother through the use of a quadratic relationship to displacement.

Activation key is now standard Enter/Return, not the numpad version

Roll control can also now be replaced by yaw control (left/right) using the tab key

It is MUCH easier to fly with the finer level of control from the new scaling. Does it still need on the fly switching (aka stock fine control mode)?

Edited by Crzyrndm
Link to comment
Share on other sites

  • 3 months later...
  • 2 weeks later...

Very useful. The feel of flying a spaceplane is much better with this. Almost a must have if you do not have a hardware joy.

Does it take any trimming into account?

And one more thing I've noticed: if I set my controls to, say, a level flight at low speed and press "Enter" to exit control mode then my spaceplane noticeably ducks. Seems like it doesn't remember control angles and just sets everything to neutral when released. That annoys a bit if happens on final approach or other near-stall or low altitude flight situations.

Some suggestions:

Really lacks a vertically inversed mouse input as controlling in the present way is a bit unnatural.

Would be useful to have a toggleable centerline display (with configurable transparency). But do not overdo with displayed things as I really love that your mod doesn't block the view by anything.

Edited by Ser
Link to comment
Share on other sites

Does it take any trimming into account?

And one more thing I've noticed: if I set my controls to, say, a level flight at low speed and press "Enter" to exit control mode then my spaceplane noticeably ducks. Seems like it doesn't remember control angles and just sets everything to neutral when released. That annoys a bit if happens on final approach or other near-stall or low altitude flight situations.

Some suggestions:

Really lacks a vertically inversed mouse input as controlling in the present way is a bit unnatural.

Would be useful to have a toggleable centerline display (with configurable transparency). But do not overdo with displayed things as I really love that your mod doesn't block the view by anything.

Trimming not acounted for I believe, and yes when it disengages everything goes back to neutral.

RE: Suggestions

I really should do some work on this. Originally it was a spinoff of some prep work I was doing for Pilot Assistant and it hasn't had all that much attention since.

I agree entirely with your suggestions, it's just a matter of finding some time to do some work on this :)

Link to comment
Share on other sites

Analog Control v1.2

  • Added invert pitch axis option
  • Added optional HUD target to indicate location of deadzones. Transparency configurable
  • .version file
  • No longer a part module (why it ever was, I don't know)

7X3QFzW.jpg

Settings can be found in the pluginData folder after you exit the flight scene once. Transparency is <0-1>, other options are boolean 0 or 1

Edited by Crzyrndm
Link to comment
Share on other sites

Nice!

But where have deadzone settings gone? Also it would be nice to have some non-linearity tweak because of lack of power at the edges: pressing a key has more effect than having mouse at the edge of the screen.

At my taste I'd made deadzones 2 times smaller and a steep sensitivity growth at the last quarter or fifth up to factor of 1:1 at the edge. At least in pitch because it's important to have full range of deviations there. Anyway it's individual. So separate non-linearity settings for pitch/roll/yaw would be just great.

Link to comment
Share on other sites

But where have deadzone settings gone?

Oops.

v1.3

  • Added deadzone and range settings

If you're not getting 100% action at the screen edge with default settings (as of 1.3), something is wrong. It should reach max output 2/3rds of the way to an edge.

Range setting is a percentage of screen width/height, deadzone is a % of range. The center texture will resize with alterations in range and deadzone to continue indicating the deadzone border.

If you want to make a different center indication it needs a 500x500 px image and the deadzone is the center 200 pixels of each axis. I'm not averse to suggestions on how the texture can be improved

Edited by Crzyrndm
Link to comment
Share on other sites

"Groung control to Major Tom, your circuits dead, there's something wrong" :)

Now for some reason the lower-left corner is considered as a center. And crosshairs are gone. Reverted to v1.2.

If you want to make a different center indication it needs a 500x500 px image and the deadzone is the center 200 pixels of each axis. I'm not averse to suggestions on how the texture can be improved

I think that's ok. Anyway I can draw anything I like myself

Link to comment
Share on other sites

"Groung control to Major Tom, your circuits dead, there's something wrong" :)

Now for some reason the lower-left corner is considered as a center. And crosshairs are gone. Reverted to v1.2.

Er, what on earth did I do...

- - - Updated - - -

*Smacks self in head*

v1.4

  • Correctly initialised center location once more
  • Added center location to settings
  • Center now depends on trim

Link to comment
Share on other sites

Awesome. Now using this with FAR and AJE makes flying in KSP like a flight simulator.

One more good feature might be if on pressing "Enter" a mouse was placed according the current control angles, so the vessel didn't start moving. Because if trying to control a rocket during launch you hardly know where the center will be and you have nearly 100% chance to break your trajectory just by switching.

Not critical but for some reason if you try to control a rover it still lacks range: pressing a key makes it turn about twice faster. Tried 0.1, 1, 2 for rangeX.

Why the settings for center are in absolute coordinates? It would be logical to specify them as offsets relative to the actual screen center.

Should actual deadzones really depend on range settings like they do now?

Link to comment
Share on other sites

One more good feature might be if on pressing "Enter" a mouse was placed according the current control angles, so the vessel didn't start moving. Because if trying to control a rocket during launch you hardly know where the center will be and you have nearly 100% chance to break your trajectory just by switching.

How about a delay where the GUI shows up but the mouse is not yet used for control (or maybe enter once: GUI, twice: control, third time: off with a timeout of 5-10s on the first-> second stage transition)

Not critical but for some reason if you try to control a rover it still lacks range: pressing a key makes it turn about twice faster. Tried 0.1, 1, 2 for rangeX.

Why the settings for center are in absolute coordinates? It would be logical to specify them as offsets relative to the actual screen center.

Should actual deadzones really depend on range settings like they do now?

Rover: are the wheels turning at all? That sort of sounds like all turning is being done by reaction wheels or something of the sort. I'll have a poke around

Settings: Numbers are just plucked out as they are from the code. I can certainly reformat them if there is a consensus as to what is appropriate. Deadzone I'm not particularly concerned about, but I much prefer absolute coordinates (because as you mention previously, the center of the screen isn't exactly marked), although maybe a percentage of screen width/height would work better.

Edited by Crzyrndm
Link to comment
Share on other sites

I'll check that with reaction wheels off.

And one more idea that could be useful as I think: when the control mode is going to off set trimming to current position so a vessel remembers where the control surfaces were, keep going in present direction and doesn't duck. With this on exit and setting mouse on enter (as I wrote earlier) that enter/exit disturbance of a craft would be eliminated.

The difficulty may be in what to do with previously set trimming when entering control mode. It could be just dropped to default because the mouse position sets trimming in case it works as I've proposed.

Edited by Ser
Link to comment
Share on other sites

So... War Thunder "simple" controls in KSP? Fantastic!

Or MS Flight Simulator's mouse yoke, or w/e X-Plane/Prepar3d calls it. Mouse control systems are fairly common in Flight Sim's

On another note, it just occured to me that the settings file is probably (I can't test right now...) being read from disc every time you enter the flight scene. If you want to play around with the config, you should be able to just jump out to the space center, make your changes, and them jump back into flying/driving a plane/rocket/rover.

RE: Improving activation

How about enter "arm"s the system (giving you the GUI), while a mouse click unpauses/pauses control (with paused control holding the current input, probably drawing a red dot or something to indicate where that is)

Edited by Crzyrndm
Link to comment
Share on other sites

@enceos

Always nice to hear people appreciates my efforts :)


On another note:

If you're looking for something more advanced/configurable, this looks to have it well and truly covered (or will after the dev updates to include a few suggestions I made based on Analog Control).

Edited by Crzyrndm
Link to comment
Share on other sites

Version 1.5

  • Added a two stage activation when using the GUI. The first stage makes the crosshair visible, and then you can pause and unpause control (always paused when you make the crosshair visible)
  • Enter/Return is now the on/off switch (show/hide the crosshair). Left Mouse Button is pause/unpause (not available if the UI setting is false, activation remains as it was with that)
  • After transferring from an unpaused to a paused state (normal input still functions after you show the crosshair until you unpause control), the mouse position is remembered and continues to be used for outputs.
  • A small dot is placed at the cursor location when control is paused so you can re-engage smoothly

The marker texture is a 20x20 PNG, with the last cursor position being centered at (10,10). If you want it gone just replace it with a fully transparent PNG of the same size (or edit it to your preference ofcourse)

If you want the pause/hold functionality without the crosshair you can always set the transparency to full.

OP usage instructions updated to reflect changes

Instructions for use:

  1. ​Press the Enter/Return key to make the UI visible (control remains w/e you were using without this mod)
  2. Click the Left Mouse Button to activate mouse control
    • Tab key allows switching between roll (default) and yaw control. This can be changed at any time and is persistent through a flight, but the only indication of the current mode is the control behaviour :wink:

[*]Click again to pause mouse control (control output will remain as it was when you pause)

[*]Press Enter/Return key to regain control through other flight inputs.

And a new video

NOTE:

The pause function is only remembering where you had your mouse when it was activated. Changing the trim and switching between yaw/roll control will change the outputs

Edited by Crzyrndm
Link to comment
Share on other sites

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