Simulate mouse move in 3D games?
Hi I made a human computer interface to control mouse using fingers using C++ and Ope开发者_C百科nCV in CodeBlocks IDE http://www.youtube.com/watch?v=-q5aXTg0pVE I want to use this in a 3D game like medal of honor
First I used SetCursorPos(x,y) it did not work so I switched to SendInput and mouse_event. They did work with a bug the character began pointing in all random directions and changing directions on its own.
Should I use directinput as the game uses directx. If so how? I have tried many tutorials but all speak about how to get data from mouse but not how to insert into the mouse stream I used both absolute and relative positioning but both failed the character is behaving odd
Without seeing your code, this answer is a bit of a long shot, but here goes.
SendInput
should work, but I think the game is interfering by using SetCursorPos
itself. Many games reset the cursor to the centre of the screen each frame, so it doesn't hit the edge by accident.
Try using SendInput
with relative mouse motion, so without the MOUSEEVENTF_ABSOLUTE
flag in the MOUSEINPUT
struct.
精彩评论