Forum rules - please read before posting.

Moving cursor by keyboard?

Hello, my game is using the "Direct" movement method. In some puzzle solving interface, I would like to have the player control a cursor on the screen. While switching to using mouse control is an option, I hope to include controller support as well so it would be great if the player can use keyboard/controller to move the cursor.

I did a search and found this https://adventurecreator.org/forum/discussion/6730/moving-cursor-from-script
But that question is about setting thecursor position using a script. May I ask if there is a more direct way to control the cursor by keyboard? Thanks.

Comments

  • If your Settings Manager's Input method is set to Keyboard Or Controller, then the cursor is controlled via the CursorHorizontal and CursorVertical inputs, which can be mapped to the cursor keys in Unity's Input Manager.

    See the Manual's "Keyboard or controller input" for more details.

  • Thanks. Is it possible to allow both mouse, keyboard, and controller to control the cursor at the same time?

  • I'm not sure how that would work in practice, exactly.

    You can duplicate the CursorHorizontal / Vertical inputs, and map these to the mouse X/Y axes so that the mouse also affects the cursor in "Keyboard Or Controller" input.

    Alternatively, you could write a simple script that waits for e.g. keyboard press, or a mouse click, to switch between "Mouse And Keyboard" and "Keyboard Or Controller" input methods dynamically. To get an API reference to the Input method that you can modify through script, right-click the field's label in the Settings Manager.

  • I have thought of method 2 but the method 1 you suggested is so neat! And it works perfectly so far. Thank you so much!

  • I think the cursor speed is too fast when controlled by keyboard or controller. Are there any parameters I can tune to slow it down?

  • See the "Cursor Move Speed" property in the Player Input Inspector on the Game Engine object/prefab.

  • That's convenient. Thanks.

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.