模拟鼠标移动3D游戏? [英] Simulate mouse move in 3D games?

查看:469
本文介绍了模拟鼠标移动3D游戏?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

喜 我做了一个人机交互界面用手指使用C ++和OpenCV在$ C $个cblocks IDE控制鼠标 http://www.youtube.com/watch?v=-q5aXTg0pVE 我想用这个在3D游戏等荣誉奖章

Hi I made a human computer interface to control mouse using fingers using C++ and OpenCV in CodeBlocks IDE http://www.youtube.com/watch?v=-q5aXTg0pVE I want to use this in a 3D game like medal of honor

首先,我用SetCursorPos(X,Y),它没有工作,所以我切换到SendInput和mouse_event。 他们没有工作,一个错误的字符开始指向所有方向是随机改变自己的方向。

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.

我应该使用的DirectInput作为游戏使用DirectX。 如果是的话怎么样? 我试过很多教程,但都谈论如何从鼠标的数据,但并不怎么插入到鼠标流 我用绝对和相对定位,但两者失败的字符表现奇

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

推荐答案

没有看到你的code,这个答案是有点远投,但在这里不用。

Without seeing your code, this answer is a bit of a long shot, but here goes.

SendInput 应该工作,但是我觉得游戏是通过使用 SetCursorPos 自身形成干扰。许多游戏复位光标移动到屏幕的每个帧的中央,所以它不会偶然击中的边缘。

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.

尝试使用 SendInput 相对鼠标移动,这样的没有的的 MOUSEEVENTF_ABSOLUTE 标志在 MOUSEINPUT 结构。

Try using SendInput with relative mouse motion, so without the MOUSEEVENTF_ABSOLUTE flag in the MOUSEINPUT struct.

这篇关于模拟鼠标移动3D游戏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆