I'm building an application in Unreal Engine, where the user inputs are coming from a secondary device. This second device is capturing mouse movements from a Human Interface Device, and I'm sending JSON packets over UDP with the data:
{
"data" : {
"x" : 0,
"y": 0,
"mouseDown" : True
}
}
These JSON packets are streamed continuously, and on the receiving end a python script parses them and runs:
win32api.SetCursorPos((data["x"], data["y"]))
if data["mouseDown"]:
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, data["x"], data["y"], 0, 0)
else:
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, data["x"], data["y"], 0, 0)
This script works great and allow me to pass through cursor movements and mouse clicks that work with all windows applications EXCEPT my application. The cursor moves, but when my application is in focus, the clicks do absolutely nothing in the application.
Is it possible that my application written in Unreal Engine natively ignores "virtual" mouse events and requires that they originate from a HID driver? And if so, are there easy configuration settings that would allow for emulated mouse events?
The win32 commands work fine with just about eveyr other application, and my custom Unreal application works fine with a direct hardware mouse, so it really only seems to be this combination of emulated mouse clicks and my custom application causing issues.