"Do you not have an XBox or Dual Shock controller? You get one free."
This addon wraps the famous nefarius/ViGEmBus driver in a node-like API.
Use cases:
- Testing your game's controller support when you don't have an XBox or Sony controller.
- Making up and replaying controller input sequences accurately (to polish the feeling of your combat system etc.).
- Hijacking inputs of a controller at system level and forward to a virtual one (HidHide is recommended as a companion for this use case).
- And more, you get the idea.
Disclaimer:
- Not to be confused with "virtual joystick" and "virtual gamepad", which is typically an input widget that allows touchscreen players to interact with your game in a console-like manner.
- This addon is for Windows only.
- ViGEm is no longer maintained by its original author, but as a time-tested project it has served its users well. This addon only supports emulating controllers that ViGEm can, which are XBox 360 Controller and Dual Shock 4.
To install the addon:
- Make sure you have ViGEmBus driver installed (typically you'll need to reboot after installing it),
- Grab the latest godot-vigem.zip in addon release page,
- Unzip to get a folder named
addons, put it in your project's root directory, - Open your project in Godot Editor, a line should have been printed: "Connected to ViGEm bus driver.", meaning everything's ready.
- Add a
XBox360ControllerEmulatororDualShock4Emulatornode into the scene tree to create a virtual controller device, - Call its
send_eventmethod with an InputEventJoypadButton or InputEventJoypadMotion of your definition:emulator.send_event(my_event), - Your virtual controller will send the event to your system, emulating a real controller connected to one of your USB ports,
- Of course that event will loop back into your game, because the virtual device ACTS LIKE A REAL ONE,
- Removing the node from scene tree frees the virtual controller device.
- Please note that this addon is for Windows only.
- Requires Visual Studio with "Desktop development with C++" workload.
- Clone the repo with submodules:
git clone --recursive git@github.com:lfod1997/godot-vigem.git. - It is recommended to use the now-free CLion IDE, because build profiles and a run configuration have been added for the project.
- Alternatively, make sure you have CMake ≥ 3.25:
- To build for
template_debugwithDebugconfig:- Configure:
cmake -S . -B cmake-build-debug -DCMAKE_BUILD_TYPE=Debug - Build:
cmake --build cmake-build-debug --target gdvigem --config Debug
- Configure:
- To build for
template_releasewithReleaseconfig:- Configure:
cmake -S . -B cmake-build-release -DCMAKE_BUILD_TYPE=Release -DGODOTCPP_TARGET=template_release - Build:
cmake --build cmake-build-release --target gdvigem --config Release
- Configure:
- To build for double-precision Godot, add
-DGODOTCPP_PRECISION=doublewhen configuring.
- To build for
- Demo project at
/project/project.godot.

