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
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.
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:- I can't open the menu with any of the buttons. I have to open it either using the keyboard or mouse.
- 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!
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!
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:
Sorry again for the trouble, but your help and swift responses are very much appreciated.