Forum rules - please read before posting.

Controller and direct interaction

Hi,

I'm working on a game that has Direct movement method and 'Mouse and Keyboard' works great. However, I'd like to use 'Keyboard or Controller', but for whatever reason, my character automatically starts walking in one direction. I've googled the issue and from what I can tell it can be related to a number of (non-AC) things, but I figured I'd ask here to see if there's anything glaringly obvious I need to do in the AC Game Editor for it to behave properly. Anyone had any experience with this?
I should mention that, while the character moves in one direction, the controller is responsive; I can turn the character, but I can't stop.

My other query is perhaps a bit general and elementary - What would be the best way of handling direct interaction? (As opposed to mouse pointer interactivity)

What I have in mind something like this:
1. Character steps inside of a trigger box

2. The trigger causes a sprite or texture to appear above the character's head (to indicate that an object within range is interactive)

3. If the player presses a button (I guess this would be a context-sensitive action button) it would kick off various actions such as camera change followed by dialogue and options etc.

Sorry in advance if this is already covered in any of the tutorials; if it is then please could I trouble you to point me to where this is explained?


Thanks for reading and hope you can help!

Comments

  • What were the non-AC issues that you suspect the character mis-moving is down to?  Could you elaborate further on what exactly happens?  Does he always move in the same direction, and without any input from yourself?

    When under Direct movement, the player will move when the Horizontal and Vertical inputs are used - and these are mapped by default to Unity's Input manager.  There should be two sets by default - one for the keyboard, and another from the joystick.  When in Play mode, try editing / removing them to see what input is being recieved.  It may be that your controller is defaulting to non-zero input even when "rested", which could indeed be a non-AC issue.

    As for handling "direct interaction", you want to look into "Player Vicinity" Hotspot detection mode - see the "Player-vicinity detection" chapter of the Manual.  This essentially requires the Hotspot to be within a pre-set Collider attached to the Player to make it selectable - as opposed to the mouse being over it.  The 3D Demo game + Player can be used to experiment with it, and the same principle applies to 2D.

    To have an icon appear above the Player when near a Hotspot, you could try creating a new Menu that has a Position type of Above Player, and Appear type of On Hotspot.

    When a Hotspot is within the Player's vicinity, and you're using Keyboard Or Controller input, interactions are run by pressing the InteractionA input button - see the Manual's "Keyboard or controller input" chapter for more.
  • Thank you for your ideas and for helping me out. It's much appreciated!

    Not sure what happened, but I replied to the above comment earlier, however after trying to edit my post it just vanished (pending review or something?). In any case, I'll give it another go:

    Regarding direct control - the root of the issue was with the actual controller, so I'm sorry to trouble you with that. For anyone that may be interested, I use a bluetooth SteelSeries XL controller which has had some issues with Windows 10.  However, after downloading the SteelSeries app and updating the controller it works fine.

    With the view to be able to play with keyboard or controller, this is where I'm currently at:
    • Keyboard and mouse input is working great.
    • I can walk around freely using my controller (left joystick).
    • As I've ticked "Auto-select first element" in the Menu screens, I can, with the controller, move up and down on the Pause Menu (Resume, Options, Save, Load, Quit)
    • I can use the "A" face button (I believe this is "joystick button 0") on my controller to interact with the menu. eg. I can press "A" when "Load" is highlighted and it will take me to the Load screen.
    Here's where I'm having difficulties:
    1. I can't open the menu with any of the buttons. I have to open it either using the keyboard or mouse. 
    2. The only place "Auto-select first element" works is in the Pause Menu. (Perhaps I can manually select the Elements in the other screens). In other words, I can't navigate any other menu beside the Pause Menu.
    Would I need to edit ActionSystemLock.cs somehow to get it working?

    As for the hotspots - I haven't gotten it working yet, but I'll spend some time with the documentation and tutorials before bombarding you with any unnecessary questions :)

    Thanks again!
  • What are your AC/Unity version numbers?

    1) You're specifically referring to the Pause menu?  The default setting has its Appear type set to On Input Key, and the Input button it responds to is named "Menu".  AC creates an input mapped to the Escape key upon installation, but you can create another / modify this to map to your controller in Unity's Input Manager.

    2) Which other Menus specifically are not working, and what have you set them to?  Are they all relying on Unity UI, or Adventure Creator?  The ability to directly-control menus depends on a few factors - and these are covered in the Manual's "Navigating menus directly" chapter.
  • Thank you for your help!

    I'm currently on:
    - Unity 2018.1.0b13
    - AC 1.59

    I'm using Unity UI (Prefab). I haven't really touched the UI yet, so it should all be more or less default AC templates.

    I managed to change the input so I can open and close the menu using my "Y" face button (joystick button 3). Works great, thanks. :)

    However, I'm not quite sure how to get the auto-select first visible element to work.
    I tried to manually change the first selected element to: "btnLoad" as a test, but it didn't work. I'm guessing it's related to this part in the manual: "Gameplay menus can only be direct-controlled if the Engine: Manage systems Action is used to allow it."

    Under Actions/Engine, I have:
    4: Engine: Manage systems DEFAULT

    Do I need to change this in any way?

    Not sure if it helps, but just to give it some more context:

    Settings:
    Movement method: Direct
    Input method: Keyboard of Controller
    Interaction method: Context Sensitive

    "Assume inputs are defined" - OFF

    Menu:
    "Directly-navigate Menus when Paused?" - ON
    "Directly-navigate Menus during conversations?" ON
    "Disable mouse when keyboard-controlling Unity UI Menus?" OFF

    "Auto-select first visible Element?" ON


    Thanks again!
  • OK, but which menus are you talking about here?  One of the "Pause" menus (i.e. Load/Save/Options), or one that runs during gameplay)?

    If it's during gameplay, you're correct in that the Engine: Manage systems Action is necessary to enable direct-navigation while it's on.  You haven't said how you're using it, however, and I'm not sure what you mean by "DEFAULT".  As in, you haven't changed any of the options?

    The easiest way to allow for this is to define ActionList assets that run when the Menu is both turned on and off.  These can be created/assigned in the Menu's properties box.

    With each of these ActionLists, set their When running fields to Run In Background, and give them both the Engine: Manage systems Action.  For the "Turn on" ActionList, set the Control in-game Menus field to Enabled, and for the "Turn off" ActionList, set it to Disabled.
  • Sorry, I'm talking about all of the menus on Pause, not the single "Menu" button that runs during gameplay.

    What I'm referring to is, for example, the Pause menu that includes:
    "Resume, Options, Save, Load, Quit"
    Or:
    "Load game: Save 1, Save 2 etc., Back"

    I can open and close the menu Pause menu (Resume, Options, Save, Load, Quit) using "joystick button 3", but none of the buttons (or elements) are selected, even if I tick "Auto-select first visible Element" or manually select it.

    I'm a bit fuzzy about what this means:"Gameplay menus can only be direct-controlled if the Engine: Manage systems Action is used to allow it."

    The Engine: Manage systems is set to Default, though I'm not sure if this is relevant to the above.



    The Menu settings look like this:
    image
  • The menu properties look fine - though try checking Disable mouse when directly-controlling Unity UI Menus? just in case.

    You're a little ways out of date with your AC version.  In a backup/duplicate project, import v1.63.2 and observe the "Upgrade notes" for the interim releases in the Changelog file.  Does that address the issue?

    That the Engine: Manage systems Action is marked as "DEFAULT" has no bearing - it just means that any new Action you create in an ActionList will be set to that, making it convenient if you use it often.  It's best left set to Engine: Wait.

    • "Gameplay menus can only be direct-controlled if the Engine: Manage systems Action is used to allow it"
    Direct control of menus during gameplay is normally prevented, to avoid conflict with navigating / interacting with the scene itself.  An instance of the Engine: Manage systems Action is necessary to specificically tell AC when this is allowed - and by that I mean the creation of such an Action within an ActionList, not anything to do with the Actions Manager.

    However, since you're only dealing with menus while the game is paused, this aspect can be ignored.

    Try upgrading, make sure your Input method is still set to Keyboard Or Controller, and if things still don't work, PM me a .unitypackage file of your Manager asset files and UI prefabs, and I'll take a look.
  • I'm happy to say that after updating AC (to v1.63.2) everything just magically works! How neat!

    Sorry again for the trouble, but your help and swift responses are very much appreciated. :)
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.