Touch JoyPad (Gamepad)

An asset by shinneider
The page banner background of a mountain and forest
Touch JoyPad (Gamepad) thumbnail image
Touch JoyPad (Gamepad) thumbnail image
Touch JoyPad (Gamepad) thumbnail image
Touch JoyPad (Gamepad) thumbnail image
Touch JoyPad (Gamepad) hero image

Quick Information

0 ratings
Touch JoyPad (Gamepad) icon image
shinneider
Touch JoyPad (Gamepad)

This is easy way to put a joypad in your godot project.

Supported Engine Version
3.2
Version String
1.0.0
License Version
MIT
Support Level
community
Modified Date
3 years ago
Git URL
Issue URL

Godot Touch Joy Pad

Install:

  1. Manual Mode.

    1. Create plugins folder in project root.
    2. Download this repo and put all files inside a touchJoyPad folder (inside a plugins folder).
    3. Use touchJoyPad.tscn scene in your project.
  2. Git Mode.

    1. if you not started git repo before, start it git init
    2. in first time git submodule add https://github.com/shinneider/godot_touchJoyPad.git ./plugins/touchJoyPad
    3. in next repo clone, clone normally, after clone, run git submodule update --init --recursive

Configuration:

  1. Basic configuration.

    1. Arguments. After import scene check Inspector tab of Godot
      1. Left Pad Style: Select tipe of Joy, a classical D-Pad or a modern Analog.
      2. Map Analog to DPad: Analog send analogic signal(between -1 and 1), but if set this, the signal is converted to natives ui_left, ui_up, ui_right and ui_down signal (if you need, is possible to receive analog singal too).
      3. Visible Only Touchscreen: Visible only in devices with touch capabilities.
      4. Analog Tap To Show: This show the analog just if user tap in the screen.
  2. Receive Analog movimentation.

    • The touchJoyPad is attached to the group Joystick see this
    • On each Analog movimentation ths function analog_signal_change is fired. The func analog_signal_change analog_signal_change analogPosition and analogName.
    • The analogPosition argument is x,y Analog coordinates (x and y contains values between -1 and 1) being that x < 0 is moving to the left, x > 0 moving to right, y < 0 moving down, y > 0 moving to up, and finally x = 0 and y = 0 isn't moving.
    • The analogName argument is way to filter Analog signal if you decide to re-use the Analog scene (Ex: two analog in screen, left for movimentation and right for aim).
    • Ex: analog_signal_change implementation.
      func analog_signal_change(analogPosition, analogName):
         # When to move Analog, send signal to natives ui signal
         # but implements a dead zone in 20% in the curso of Analog
         # This is good for to avoid user mistakes in move hand
         Input.action_press("ui_left") if analogPosition.x < -0.2 else Input.action_release("ui_left")
         Input.action_press("ui_right") if analogPosition.x > 0.2 else Input.action_release("ui_right")
         Input.action_press("ui_down") if analogPosition.y < -0.2 else Input.action_release("ui_down")
         Input.action_press("ui_up") if analogPosition.y > 0.2 else Input.action_release("ui_up")
      
  3. Analog Tap To Show.

    • If you need to use this, you need to put de scene inside a ViewportContainer or a error occurs and not compile.
    • This occurs because the ViewportContainer is used to determine a area of Tap To Show.
    • Ex: two Analog, one in each corner of the screen, the ViewportContainer determines area of each Analog, without this all screen active the two analogs
  4. Obs in standalone use of DPad or Analog.

    1. If you need to use manually the plugins, you need to implement logic for this cases:
      • Hide (Because enable = false, mantains the touch area, i sugest move button for out of the screen position = Vector2(-1000, -1000)).
      • Hide if touch device (Check if touch device using OS.has_touchscreen_ui_hint()).
      • Pass the param AnalogTapToShowContainer (Used for the Analog in Tap To Show) for default he search ViewportContainer in up parent, but if you need, just specify a parent for her (Ex: $"leftPad/JoyStickLeft".AnalogTapToShowContainer = get_parent()).
  5. Help in Test/Debug.

    • to help in your test in desktop without touchscreen, enable godot touch emulator.
    • Go to Project Settings, on the left menu search Pointing inside Input Devices.
    • Enable Emulate Touch From Mouse, on this enable, mouse is used as touch on the screen.

Images:

Using D-Pad: README dpad

D-Pad Pressed: README dpad

Using Analog: README Analog

Using Analog with tap to show: README tapToShow

Credits

This is easy way to put a joypad in your godot project.

Reviews

0 ratings

Your Rating

Headline must be at least 3 characters but not more than 50
Review must be at least 5 characters but not more than 500
Please sign in to add a review

Quick Information

0 ratings
Touch JoyPad (Gamepad) icon image
shinneider
Touch JoyPad (Gamepad)

This is easy way to put a joypad in your godot project.

Supported Engine Version
3.2
Version String
1.0.0
License Version
MIT
Support Level
community
Modified Date
3 years ago
Git URL
Issue URL

Open Source

Released under the AGPLv3 license

Plug and Play

Browse assets directly from Godot

Community Driven

Created by developers for developers