I’ve been using MT Pro for a few years now as a way to let me use my Roland Aerophone AE-10 as a game controller. It’s been working out better than I had ever imagined, but I’ve been running into one consistent wall in trying to branch out: using Note On/Off messages to control mouse movement.
In a lot of the games I play, I have been able to map the in-game camera movement to keyboard inputs with no issue — however, the problem comes when I play games where the camera can only be controlled by the mouse. When I have tested out some rudimentary mouse controls in MT Pro with my aerophone, the issue that pops up is that the Outgoing Mouse Movement controls the mouse cursor, whereas most games read the Mouse Movement Delta (Change in position) information to control the camera. In practice, that means that when I use my aerophone to move the camera, it can only turn until the mouse cursor bumps up against the edge of the screen, whereas a mouse moving left or right can spin the camera infinitely until the mouse stops moving.
Do you have any clever/creative ideas that could help solve this issue? Or is there something more obvious or something I missed that I could do to fix this issue? I’ve also attached my test MT file if you want to take a look.
From what I understand you do not want your mouse to go beyond the borders of the screen. In that case, we need to initially calibrate the mouse position and then track it in global variables as it moves.
I added translator 2.12 for mouse calibration. This should set you mouse to the center of the screen. You might need to adjust the rules for your screen size.
Here are the rules
// Screen width
ga=1920
// Screen height
gb=1080
// Current Mouse x location
gc=0
// current mouse y location
gd=0
// Put mouse to center of screen
// vertical
gc=ga/2
// horizontal
gd=gb/2
Then I modified the rules of translator 2.1, 2.4, 2.7, and 2.10 to not allow moving of the mouse (move by 0) if they bump up against the screen limit.
Here are the rules for 2.1
// move amount
pp=-9
gd=gd+pp
if gd<0 then gd=0
Log "Up X=%gc% Y=%gd%"
if gd==0 then exit rules, skip Outgoing Action
This may not be 100% precise but should get you close.
Be sure you center the mouse before you start as MT Pro cannot read the current mouse position.