Add a built-in virtual controller#116716
Conversation
3cc76a1 to
dca8e32
Compare
| @@ -257,6 +260,7 @@ void VirtualJoystick::_bind_methods() { | |||
| ADD_SIGNAL(MethodInfo("released", PropertyInfo(Variant::VECTOR2, "input_vector"))); | |||
| ADD_SIGNAL(MethodInfo("flicked", PropertyInfo(Variant::VECTOR2, "input_vector"))); | |||
| ADD_SIGNAL(MethodInfo("flick_canceled")); | |||
| ADD_SIGNAL(MethodInfo("motion", PropertyInfo(Variant::VECTOR2, "input_vector"))); | |||
There was a problem hiding this comment.
"motion" is a bit of a misleading name IMO, it sounds like a property
|
Hello! I haven't tested this PR, but so far I think it looks nicely done, good job! :) |
|
Project Settings or directly from the input singleton? Also currently I m not sure which Node I can use to add the VietualController as Child. |
I think having both would be nice, see also #115119 for an example of creating a project setting + |
|
Should the Virtual Controller only show up when there is a Touchscreen available? |
dca8e32 to
bb02cb6
Compare
|
For pressing multiple buttons at the same time, #110893 is needed to get merged |
|
I'm not sure |
|
Cameras have nothing to do with input though |
There was a problem hiding this comment.
I created a commit in one of my fork's branch to decouple Input from VirtualController and scene/ files: Nintorch@a931913
In that same commit I also deregistered VirtualController so its nodes can't be created in scenes directly by the user, I'm not currently sure it makes sense to allow that since the current functionality of enabling it through the Input property and a project setting should be enough, unless we want to allow the users to create 2 or more VirtualControllers or allow them to be freely modified. :) (EDIT: I just noticed that you're planning to make VirtualController customizable, in this case it does make sense for its nodes to be created directly by the user, so you can ignore that change by me in my commit! :D)
I also tested the functionality of VirtualController on Windows today. I think it mostly works as expected, except for 2 notes here:
- I think when the
VirtualControlleris visible, Godot should register it as a connected joypad, so projects like https://gist.github.com/anthonyec/5342fce79b2b7b22ada748df0ad7f7c0 and joypad functions likeInput.get_joy_axis()orInput.is_joy_button_pressed()can also be used with it. VirtualControlleris not suited for smaller output sizes at the moment. This can be a problem if it's used for pixel art games.
Otherwise I think it looks nicely done! :)
|
@Nintorch I added the changes from your branch. I also registered the virtual controller, so the gamepad debugger works. I noticed that the Dpad Up, Down and Right Button doesn't work. I couldn't find the reason? Did you have the same problem? 2026-03-01.15-56-53.mp4 |
990cc55 to
897ae64
Compare
|
I did have the same problem with dpad, yes. I'm not exactly sure what's causing it, but I think UI navigation might be messing with it. This should be an easy fix though, we just first need to create a Another small suggestion I have is that we may need to separate
The reason for that is that we probably don't want to create this node at the scene root for all Godot games, even the ones that won't use it, and we don't want joypad 0 to always be reserved for |
|
Calinou suggested using CanvasLayer as a base here: godotengine/godot-proposals#11193 (comment) I also agree that the VirtualController shouldn't be instantiated for every project. That's why my initial commit created and destroyed always the virtual controller instead of hiding and showing it when enabling. |
|
@Nintorch what would you suggest to fix the problem with smaller output sizes? |
Sorry for late reply, I just noticed this question. 😅 |
|
Also what about the Buttons text? Do we want to have some sort of Icons. Or do we keep the simple text? |
|
I think having icons by default would be nice, but I feel like we may need to wait for an answer from the usability team to see what they think :) |
8f5fa8c to
6e51a97
Compare
b1e0d9d to
a9eb624
Compare
|
🐧 Can it be reproduced on other platforms as well? (without cache_path)
|
|
Input is in core, so it should never include anything in "scene/". |
There was a problem hiding this comment.
I just tested the feature; this is a great first step but there are still quite a bit of polish to be done before we consider it done and ready:
- Multiple buttons cannot be pressed at the same time - fixed by #118608
- Buttons should highlight on hover / press to show they are being interacted with
- The virtual controller needs a configuration screen to allow developers to configure to match their game needs:
- Need an option to hide / show each joystick and buttons
- Need an option to update the buttons / joysticks contrast in order to make them more visible on light background
- Need an option to configure the joystick (e.g: inverted / regular), or just expose the virtual joystick configuration options
- Need an option to map an action to a button press
I think this would be great to land in Godot 4.8 so I've updated the milestone accordingly. @Kazox61 Are you able to drive this PR forward to target a 4.8 release?
|
Yes I would like to continue. Currently I don't who should be the owner/parent of the |
| for (Node *E : to_add) { | ||
| sml->get_root()->add_child(E); | ||
| } | ||
|
|
There was a problem hiding this comment.
Unrelated, please restore
@kitbdev Do you have any suggestions? |
|
I really don't know much about this feature, but here's my suggestions. I don't know if it needs a property in addition to the project setting, but if you really want a property on the Input singleton, it could emit an unexposed signal (prefixed with Edit: It's been mentioned in the proposal that SceneTree isn't a good fit and I agree, but I don't think we have anywhere else for it. Maybe a new singleton? |



Closes godotengine/godot-proposals#11193
The Virtual Controller creates Joypad-Motion and -Button events. This enables testing games on mobile devices if you setup Joypad controls in the Inputmap.
2026-02-24.14-45-00.mp4
TODO:
Customizable Buttons and Joysticks Textures
Customizable Layout
Show and hide Virtual Controller from Input Singleton
Bugsquad edit: This PR closes Add analog joysticks to window Embedding game for android godot-proposals#12218 and supersedes Add iOS virtual controller support #97530