Forum rules - please read before posting.

Mouse and Keyboard AND Controller

edited June 2015 in Technical Q&A
Hello, i have problem with input methods, i need to make a unviersal controls for my game. (I'm using First Person movement.)
- when i use "Mouse and Keyboard", I can setup all butons for gamepad except "Interaction" :(
- when i use "Keyboard or Controller" i can setup interaction button (InteractionA, InteractionB) but mouse doesn't work in that case.
I can not publish my game without a universal control.
I would be grateful for the help.

If some issue like this has already been discussed, I would be grateful for the link, I searched on the forum but found nothing.

Comments

  • What do you mean by universal control, exactly?  If you want to be able to switch input method mid-game, you'd have to write a custom Action that does this for you.  All you really need to do is call the following, eg:

    AC.KickStarter.settingsManager.inputMethod = InputMethod.MouseAndKeyboard;

    You could place this inside the Run () function of a custom Action, and call it when the player clicks e.g. a menu Button.  Custom actions are detailed here.
  • edited June 2015
    by universal control i mean how things are going with any modern PC game:
    User launches the game, takes any controls and he ready to play, without any settings or menu buttons.
  • The mouse should still work in Keyboard Or Controller input, but you'll need to define "CursorHorizontal" and "CursorVertical" inputs to read the mouse's X and Y axes.  You can adjust the speed of it with the "Cursor move speed" in the PlayerInput component (found on the GameEngine object in your scene).

    image

    Going further, you could write a custom script that detects the first control input to be used (e.g. check if "InteractionA" is used, or the mouse cursor is moved, and change the inputMethod variable based on that, but let's see how far we can go with defining those new inputs first.
  • edited June 2015
    "CursorHorizontal" and "CursorVertical" inputs is defined, with "Keyboard Or Controller" input mouse doesn't work in menus.

    about switch inputs (AC.KickStarter.settingsManager.inputMethod = InputMethod.MouseAndKeyboard;)
    I tried make it using ActionTemplate (place this inside the Run () function) but i have an error - `AC.KickStarter' does not contain a definition for `settingsManager'. 
    I'm not a programmer( 
    i'm using AC for visual programming. 

    About script that detects the first control input to be used - this will be a great upgrade for functionality of AC ;) (latest game i saw that using this method is Witcher 3)
  • If you have any scripts with similar names (e.g. "KickStarter") in your project from any other third-party assets, that may conflict with the line of code I wrote - unless you update AC to v1.46.  Have you updated to the latest version?
  • edited June 2015
    Hello, I've updated AC to v1.46e, Unity to 5.1.1f1 and problem is gone. Thank you.
    The possibility auto-detect the control input is still important to me.

    P.S. After updating i have new problem =\
    i created a new discussion here
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.