Unity Native Plugin for DirectInput
Budget: $30 – $250 USD
I need a native plugin (C++ DLL) that interfaces with DirectInput to read input from a Fanatec wheel (throttle, brake, clutch, gear) and send force feedback commands. The plugin will be used in a Unity project that builds with IL2CPP, so the solution must be compatible with IL2CPP and avoid marshaling issues with delegates.
Requirements:
DirectInput Integration:
The plugin must use DirectInput to communicate with a Fanatec wheel or similar racing wheel hardware.
It should read the following inputs:
Throttle (0 to 1)
Brake (0 to 1)
Clutch (0 to 1)
Gear (integer, e.g., -1 for reverse, 0 for neutral, 1-6 for gears)
It should support sending force feedback commands to the wheel.
Native Plugin (C++ DLL):
The plugin should be written in C++ and compiled into a DLL.
It should expose the following functions for Unity to call:
cpp
Copy
void InitializeDirectInput();
void ReadInput(float* throttle, float* brake, float* clutch, int* gear);
void SetForceFeedback(float force);
Unity Integration:
The plugin should be compatible with Unity's IL2CPP backend.
Provide a sample Unity C# script that demonstrates how to:
Initialize the plugin.
Read input data (throttle, brake, clutch, gear) in the Update loop.
Send force feedback commands to the wheel.
Performance:
The plugin must be efficient and capable of running at 60 FPS or higher without significant CPU overhead.
Error Handling:
Include proper error handling for cases where the device is not connected or input is lost.
Documentation:
Provide clear documentation on:
How to use the plugin in Unity.
How to rebuild the DLL if needed.
Any dependencies or setup required.
Deliverables:
A compiled C++ DLL for Windows (x86 and x64).
Source code for the C++ plugin.
A Unity project with a sample script demonstrating how to use the plugin.
Documentation for setup and usage.
Requirements:
DirectInput Integration:
The plugin must use DirectInput to communicate with a Fanatec wheel or similar racing wheel hardware.
It should read the following inputs:
Throttle (0 to 1)
Brake (0 to 1)
Clutch (0 to 1)
Gear (integer, e.g., -1 for reverse, 0 for neutral, 1-6 for gears)
It should support sending force feedback commands to the wheel.
Native Plugin (C++ DLL):
The plugin should be written in C++ and compiled into a DLL.
It should expose the following functions for Unity to call:
cpp
Copy
void InitializeDirectInput();
void ReadInput(float* throttle, float* brake, float* clutch, int* gear);
void SetForceFeedback(float force);
Unity Integration:
The plugin should be compatible with Unity's IL2CPP backend.
Provide a sample Unity C# script that demonstrates how to:
Initialize the plugin.
Read input data (throttle, brake, clutch, gear) in the Update loop.
Send force feedback commands to the wheel.
Performance:
The plugin must be efficient and capable of running at 60 FPS or higher without significant CPU overhead.
Error Handling:
Include proper error handling for cases where the device is not connected or input is lost.
Documentation:
Provide clear documentation on:
How to use the plugin in Unity.
How to rebuild the DLL if needed.
Any dependencies or setup required.
Deliverables:
A compiled C++ DLL for Windows (x86 and x64).
Source code for the C++ plugin.
A Unity project with a sample script demonstrating how to use the plugin.
Documentation for setup and usage.