Comprehensive DIY guide for a working and reliable Relative Mouse Toggle
[video=youtube_share;OnaW1XtCkM0]https://youtu.be/OnaW1XtCkM0[/video]
As a trackball user by myself, I always felt that we cannot addresses all the flight mechanics needs without a proper relative mouse toggle switch.
Frontier have not released yet such an obvious option in the controls setup so, after many trials, I figured out how to properly implement this. To me, of course. If you feel that there are better solution, please do not hesitate to contribute them, as I'll continuously update that guide whenever some improvement is made.
Enjoy!
# Preliminary Information
This solution rely on two sets of axis - provided by vJoy - which translate the mouse/trackball movement in absolute and relative movements.
When we have this, it's just a matter of make Elite: Dangerous listen to the correct pair of axis when we want... more on this later.
# First Step - Install the needed tools
This solution use two awesome tools: vJoystick and FreePIE.
First, you need to install and create at least one vJoy device. If you already have it, create a device for our use.
Then, go to http://andersmalmgren.github.io/FreePIE/ and download and install FreePIE. It permit us to manipulate the mouse/trackball feed and create the needed axis.
As soon as we have the requirements fulfilled, we can proceed.
Save the following scripts in a convenient folder, with a meaning name - i.e. RelativeMouse.py - and open it in FreePIE.
The script is decently well commented, and pretty self explanatory.
As previously mentioned, it create two parallels and different axis feeds from mouse/trackball movements. One pair, the X and Y axis, give absolute movement. RX and RY give, of course, a relative movement.
Run the script - press F5 - and, if your devices are numbered like mine, you are ready. If not, check the index - vJoy[n] - and you'll be able to have it correctly configured.
When everything is ok, you'll see in FreePIE Watch panel that the values of the axis changes when you move your mouse/trackball.
# Second Step - Have Elite: Dangerous map your axis the way we need
I found that, for the best experience, it's better to disable the mouse from the controls - at least, in flight, the buggy could be different...
Then, we need to set the vJoy RX and RY axis to the main flight rotation control set. This way, when we start the game, we starts in Relative Mouse switch on, so when we undock we do not have any sudden strange movements. Feel free to invert this, if you dare...
I prefer to have my X axis as Yaw. The examples provided follow that bias...
Then, configure the other axis pair - X and Y - to the alternate flight controls set. Do not forget to create map a convenient key/button to switch from main to alternate controls...
If you want, you can override the axis used during landing, for convenience. So, you can do this way:
# Third Step - check your setup in a Training Mission!
You'll see that this solution I'm presenting provide some very smooth supercruise flying experience. It's somewhat like a light-FA-Off. Check this...
# Fourth Step - Fly smart, fly safe!
[video=youtube_share;zaSDraSuQXw]https://youtu.be/zaSDraSuQXw[/video]
[video=youtube_share;Pi38W1-JWbc]https://youtu.be/Pi38W1-JWbc[/video]
[video=youtube_share;OnaW1XtCkM0]https://youtu.be/OnaW1XtCkM0[/video]
As a trackball user by myself, I always felt that we cannot addresses all the flight mechanics needs without a proper relative mouse toggle switch.
Frontier have not released yet such an obvious option in the controls setup so, after many trials, I figured out how to properly implement this. To me, of course. If you feel that there are better solution, please do not hesitate to contribute them, as I'll continuously update that guide whenever some improvement is made.
Enjoy!
# Preliminary Information
This solution rely on two sets of axis - provided by vJoy - which translate the mouse/trackball movement in absolute and relative movements.
When we have this, it's just a matter of make Elite: Dangerous listen to the correct pair of axis when we want... more on this later.
# First Step - Install the needed tools
This solution use two awesome tools: vJoystick and FreePIE.
First, you need to install and create at least one vJoy device. If you already have it, create a device for our use.
Then, go to http://andersmalmgren.github.io/FreePIE/ and download and install FreePIE. It permit us to manipulate the mouse/trackball feed and create the needed axis.
As soon as we have the requirements fulfilled, we can proceed.
Save the following scripts in a convenient folder, with a meaning name - i.e. RelativeMouse.py - and open it in FreePIE.
Code:
# Title: Trackball/Mouse to Analog Axis for Elite: Dangerous, with "Relative Mouse" additional axis.
# Author: Andrea Spada
# Version: 3.3
#
# Features: Simulate analog axis from mouse for yaw and pitch. It use vJoy.
#
# Each mouse direction is mapped to two axis. So, for lateral movement, we have both X and RX axis.
# Vertical movements are mapped to Y and RY.
#
# X and Y give absolute mouse movement, like an analog joystick. They are smart auto-centering when near the center.
# The range of this self-centering (mostly for aim purpouse) is defined by a customizable radius.
# They also has a small exponential curve, so near zaro they give a smooth movement. The farther, the coarser.
#
# RX and RY axis give relative mouse movement, not unlike a directional pad. It's perfect for flying FA-Off, or for
# more precise situations: mining, landing, etc...
#
# Both movement can be easily tweaked in sensitivity.
from System import Int16
if starting:
# Timer, for auto-centering
system.setThreadTiming(TimingTypes.HighresSystemTimer)
system.threadExecutionInterval = 5 # loop delay
# Devices and axis initializing
max = Int16.MaxValue*0.5+0.5 # 16384
min = -Int16.MaxValue*0.5-0.5 # -16384
mouseX = 0
mouseY = 0
mouseXcurved = 0
mouseYcurved = 0
mouseRX = 0
mouseRY = 0
# Coordinates for self centering
a = 0
b = 0
c = 0
d = 0
global absolute_sens, relative_sens, smart_speed, rel_speed, curve, pradius, nradius
absolute_sens = 50 # absolute mouse mode sensitivity
relative_sens = 100 # relative mouse mode sensitivity
smart_speed = 25 # smart-centering speed, in absolute mouse mode
rel_speed = 1000 # hard-centering speed, in relative mouse mode
curve = 3 # exponential factor for the axis curve
pradius = 3000 # smart self-centering radius, for absolute mouse
nradius = pradius - (pradius *2) #
#
###
##### Mouse
# axis definition
mouseX += mouse.deltaX * absolute_sens # absolute mouse, lateral
mouseY += mouse.deltaY * absolute_sens # vertical
mouseRX += mouse.deltaX * relative_sens # relative mouse, lateral
mouseRY += mouse.deltaY * relative_sens # vertical
# define a range and limit the axis values
if (mouseX > max):
mouseX = max
elif (mouseX < min):
mouseX = min
if (mouseY > max):
mouseY = max
elif (mouseY < min):
mouseY = min
if (mouseRX > max):
mouseRX = max
elif (mouseRX < min):
mouseRX = min
if (mouseRY > max):
mouseRY = max
elif (mouseRY < min):
mouseRY = min
#
##
### Absolute Mouse
# smart centering
if (mouseX < pradius) and (mouseX > 0):
mouseX = mouseX - smart_speed
elif (mouseX > nradius) and (mouseX < 0):
mouseX = mouseX + smart_speed
if (mouseY < pradius) and (mouseY > 0):
mouseY = mouseY - smart_speed
elif (mouseY > nradius) and (mouseY < 0):
mouseY = mouseY + smart_speed
# lightly exponential curved axis
if (mouseX > 0):
mouseXcurved = math.floor((math.sqrt(( mouseX ** curve )) /2 ) / 64)
if (mouseX < 0):
mouseXn = mouseX * -1
mouseXcurved = math.floor((math.sqrt(( mouseXn ** curve )) / 2 ) * -1 / 64)
if (mouseY > 0):
mouseYcurved = math.floor((math.sqrt(( mouseY ** curve )) /2 ) / 64)
if (mouseY < 0):
mouseYn = mouseY * -1
mouseYcurved = math.floor((math.sqrt(( mouseYn ** curve )) / 2 ) * -1 / 64)
# Hard Mouse Centering (By press an hotkey)
# Useful when you need your mouse to return to the center, like when you switch workspaces or exiting galaxy map...
if keyboard.getKeyDown(Key.LeftControl):
mouseX = 0
mouseY = 0
mouseXcurved = 0
mouseYcurved = 0
if keyboard.getKeyDown(Key.Backspace):
mouseX = 0
mouseY = 0
mouseXcurved = 0
mouseYcurved = 0
# Mouse Output - Absolute Movement
vJoy[0].x = filters.deadband(mouseXcurved, 25)
vJoy[0].y = filters.deadband(mouseYcurved, 25)
#
##
### Relative Mouse
# Self Centering Alternate Axis
a += mouse.deltaX
b += mouse.deltaX
if filters.stopWatch(True,60):
c = a + 0
if filters.stopWatch(True,30):
d = b + 0
if (c - d == 0):
if mouseRX < -250:
mouseRX += rel_speed
elif mouseRX > 250:
mouseRX -= rel_speed
if mouseRY < -250:
mouseRY += rel_speed
elif mouseRY > 250:
mouseRY -= rel_speed
# Mouse Output - Relative Movement
vJoy[0].rx = filters.deadband(mouseRX, 1000)
vJoy[0].ry = filters.deadband(mouseRY, 1000)
#####
###
#
#
###
##### Diagnostics
# Mouse
diagnostics.watch(vJoy[0].x)
diagnostics.watch(vJoy[0].y)
diagnostics.watch(vJoy[0].rx)
diagnostics.watch(vJoy[0].ry)
The script is decently well commented, and pretty self explanatory.
As previously mentioned, it create two parallels and different axis feeds from mouse/trackball movements. One pair, the X and Y axis, give absolute movement. RX and RY give, of course, a relative movement.
Run the script - press F5 - and, if your devices are numbered like mine, you are ready. If not, check the index - vJoy[n] - and you'll be able to have it correctly configured.
When everything is ok, you'll see in FreePIE Watch panel that the values of the axis changes when you move your mouse/trackball.
# Second Step - Have Elite: Dangerous map your axis the way we need
I found that, for the best experience, it's better to disable the mouse from the controls - at least, in flight, the buggy could be different...

Then, we need to set the vJoy RX and RY axis to the main flight rotation control set. This way, when we start the game, we starts in Relative Mouse switch on, so when we undock we do not have any sudden strange movements. Feel free to invert this, if you dare...
I prefer to have my X axis as Yaw. The examples provided follow that bias...

Then, configure the other axis pair - X and Y - to the alternate flight controls set. Do not forget to create map a convenient key/button to switch from main to alternate controls...

If you want, you can override the axis used during landing, for convenience. So, you can do this way:

# Third Step - check your setup in a Training Mission!
- Open some mission in the training menu and verify your setup.
- Check that your axis are correctly mapped and that they work.
- Check your alternate/main controls switch.
- Now is the time to modify/tweak the parameter of the FreePIE script I provided. Modify according to your hardware, hand and taste.
- Check again.
- And again.
You'll see that this solution I'm presenting provide some very smooth supercruise flying experience. It's somewhat like a light-FA-Off. Check this...
# Fourth Step - Fly smart, fly safe!
[video=youtube_share;zaSDraSuQXw]https://youtu.be/zaSDraSuQXw[/video]
[video=youtube_share;Pi38W1-JWbc]https://youtu.be/Pi38W1-JWbc[/video]