No announcement yet.

Virtual Joystick/Swipe to emulate Keyboard Presses

  • Filter
  • Time
  • Show
Clear All
new posts

    Virtual Joystick/Swipe to emulate Keyboard Presses

    Hi There,

    I am developing an endless runner game for Android. Currently the A and D keys are set up to turn 90 degrees in a desired direction when hitting a certain OnBeginOverlap box event.

    I am having issues though when using the virtual joystick as my character does not turn but instead keeps running forward ( 90 degree turn event not triggered ).

    Is there a way the virtual joystick can emulate the A and D keys to trigger this event?

    Or is there a way that instead of using the A and D keys I can use the Gamepad Left Joystick - Left and Right to perform the 90 degree turn event in the desired direction?

    Here is my A and D key setup
    Click image for larger version

Name:	keyboard.jpg
Views:	2
Size:	390.4 KB
ID:	1181343

    Here is my attempted Gamepad setup ( Incomplete )
    Click image for larger version

Name:	Gamepad.jpg
Views:	2
Size:	388.8 KB
ID:	1181344

    Try use default ThirdPersonTemplate

    This have full controls, Joystick included to mobile,

    Joystick have values between -1 and 1 to left-right and 1 and -1 to up-down,

    If you use a ThirdPersonTemplate, you can see a return value to each control, that value is between -1 and 1, to set Scale in AddMovementInput

    In your example, OnBeginOverlap you set CanTurn true, when you press A that is fine,
    In the ThirdPersonExample you can try this in the default pre-set Joystick.