diff --git a/data/assets/util/joysticks/joystick_helper.asset b/data/assets/util/joysticks/joystick_helper.asset
index e7ed239957..e892eb49c8 100644
--- a/data/assets/util/joysticks/joystick_helper.asset
+++ b/data/assets/util/joysticks/joystick_helper.asset
@@ -9,11 +9,11 @@ local bindLocalRoll = function(name, axis)
-- We only want to store the current state in the first mode that is enabled, otherwise we will overwrite the backup
if not Joystick.State.IsInRollMode then
-- Save current axis state
- Joystick.State.Axis.Type, Joystick.State.Axis.Inverted, Joystick.State.Axis.JoystickType, Joystick.State.Axis.Sticky, Joystick.State.Axis.Sensitivity, Joystick.State.Axis.PropertyUri, Joystick.State.Axis.MinValue, Joystick.State.Axis.MaxValue, Joystick.State.Axis.IsRemote = openspace.navigation.joystickAxis("]] .. name .. "\", " .. axis .. [[);
+ Joystick.State.Axis.Type, Joystick.State.Axis.Inverted, Joystick.State.Axis.JoystickType, Joystick.State.Axis.Sticky, Joystick.State.Axis.Flip, Joystick.State.Axis.Sensitivity, Joystick.State.Axis.PropertyUri, Joystick.State.Axis.MinValue, Joystick.State.Axis.MaxValue, Joystick.State.Axis.IsRemote = openspace.navigation.joystickAxis("]] .. name .. "\", " .. axis .. [[);
end
-- Set new axis state
- openspace.navigation.bindJoystickAxis("]] .. name .. "\", " .. axis .. [[, "LocalRoll X", Joystick.State.Axis.Inverted, Joystick.State.Axis.JoystickType, Joystick.State.Axis.Sticky, Joystick.State.Axis.Sensitivity);
+ openspace.navigation.bindJoystickAxis("]] .. name .. "\", " .. axis .. [[, "LocalRoll X", Joystick.State.Axis.Inverted, Joystick.State.Axis.JoystickType, Joystick.State.Axis.Sticky, Joystick.State.Axis.Flip, Joystick.State.Axis.Sensitivity);
Joystick.State.IsInRollMode = true
]]
end
@@ -23,11 +23,11 @@ local bindGlobalRoll = function(name, axis)
-- We only want to store the current state in the first mode that is enabled, otherwise we will overwrite the backup
if not Joystick.State.IsInRollMode then
-- Save current axis state
- Joystick.State.Axis.Type, Joystick.State.Axis.Inverted, Joystick.State.Axis.JoystickType, Joystick.State.Axis.Sticky, Joystick.State.Axis.Sensitivity, Joystick.State.Axis.PropertyUri, Joystick.State.Axis.MinValue, Joystick.State.Axis.MaxValue, Joystick.State.Axis.IsRemote = openspace.navigation.joystickAxis("]] .. name .. "\", " .. axis .. [[);
+ Joystick.State.Axis.Type, Joystick.State.Axis.Inverted, Joystick.State.Axis.JoystickType, Joystick.State.Axis.Sticky, Joystick.State.Axis.Flip, Joystick.State.Axis.Sensitivity, Joystick.State.Axis.PropertyUri, Joystick.State.Axis.MinValue, Joystick.State.Axis.MaxValue, Joystick.State.Axis.IsRemote = openspace.navigation.joystickAxis("]] .. name .. "\", " .. axis .. [[);
end
-- Set new axis state
- openspace.navigation.bindJoystickAxis("]] .. name .. "\", " .. axis .. [[, "GlobalRoll X", Joystick.State.Axis.Inverted, Joystick.State.Axis.JoystickType, Joystick.State.Axis.Sticky, Joystick.State.Axis.Sensitivity);
+ openspace.navigation.bindJoystickAxis("]] .. name .. "\", " .. axis .. [[, "GlobalRoll X", Joystick.State.Axis.Inverted, Joystick.State.Axis.JoystickType, Joystick.State.Axis.Sticky, Joystick.State.Axis.Flip, Joystick.State.Axis.Sensitivity);
Joystick.State.IsInRollMode = true
]]
end
@@ -35,20 +35,20 @@ end
local permaBindLocalRoll = function(name, axis)
return [[
-- Save current axis state
- Joystick.State.Axis.Type, Joystick.State.Axis.Inverted, Joystick.State.Axis.JoystickType, Joystick.State.Axis.Sticky, Joystick.State.Axis.Sensitivity, Joystick.State.Axis.PropertyUri, Joystick.State.Axis.MinValue, Joystick.State.Axis.MaxValue, Joystick.State.Axis.IsRemote = openspace.navigation.joystickAxis("]] .. name .. "\", " .. axis .. [[);
+ Joystick.State.Axis.Type, Joystick.State.Axis.Inverted, Joystick.State.Axis.JoystickType, Joystick.State.Axis.Sticky, Joystick.State.Axis.Flip, Joystick.State.Axis.Sensitivity, Joystick.State.Axis.PropertyUri, Joystick.State.Axis.MinValue, Joystick.State.Axis.MaxValue, Joystick.State.Axis.IsRemote = openspace.navigation.joystickAxis("]] .. name .. "\", " .. axis .. [[);
-- Set new axis state
- openspace.navigation.bindJoystickAxis("]] .. name .. "\", " .. axis .. [[, "LocalRoll X", Joystick.State.Axis.Inverted, Joystick.State.Axis.JoystickType, Joystick.State.Axis.Sticky, Joystick.State.Axis.Sensitivity);
+ openspace.navigation.bindJoystickAxis("]] .. name .. "\", " .. axis .. [[, "LocalRoll X", Joystick.State.Axis.Inverted, Joystick.State.Axis.JoystickType, Joystick.State.Axis.Sticky, Joystick.State.Axis.Flip, Joystick.State.Axis.Sensitivity);
]]
end
local permaBindGlobalRoll = function(name, axis)
return [[
-- Save current axis state
- Joystick.State.Axis.Type, Joystick.State.Axis.Inverted, Joystick.State.Axis.JoystickType, Joystick.State.Axis.Sticky, Joystick.State.Axis.Sensitivity, Joystick.State.Axis.PropertyUri, Joystick.State.Axis.MinValue, Joystick.State.Axis.MaxValue, Joystick.State.Axis.IsRemote = openspace.navigation.joystickAxis("]] .. name .. "\", " .. axis .. [[);
+ Joystick.State.Axis.Type, Joystick.State.Axis.Inverted, Joystick.State.Axis.JoystickType, Joystick.State.Axis.Sticky, Joystick.State.Axis.Flip, Joystick.State.Axis.Sensitivity, Joystick.State.Axis.PropertyUri, Joystick.State.Axis.MinValue, Joystick.State.Axis.MaxValue, Joystick.State.Axis.IsRemote = openspace.navigation.joystickAxis("]] .. name .. "\", " .. axis .. [[);
-- Set new axis state
- openspace.navigation.bindJoystickAxis("]] .. name .. "\", " .. axis .. [[, "GlobalRoll X", Joystick.State.Axis.Inverted, Joystick.State.Axis.JoystickType, Joystick.State.Axis.Sticky, Joystick.State.Axis.Sensitivity);
+ openspace.navigation.bindJoystickAxis("]] .. name .. "\", " .. axis .. [[, "GlobalRoll X", Joystick.State.Axis.Inverted, Joystick.State.Axis.JoystickType, Joystick.State.Axis.Sticky, Joystick.State.Axis.Flip, Joystick.State.Axis.Sensitivity);
]]
end
@@ -56,9 +56,9 @@ local unbindRoll = function(name, axis)
return [[
-- Reset previous state
if (Joystick.State.Axis.Type == "Property") then
- openspace.navigation.bindJoystickAxisProperty("]] .. name .. "\", " .. axis .. [[, Joystick.State.Axis.PropertyUri, Joystick.State.Axis.MinValue, Joystick.State.Axis.MaxValue, Joystick.State.Axis.Inverted, Joystick.State.Axis.IsRemote);
+ openspace.navigation.bindJoystickAxisProperty("]] .. name .. "\", " .. axis .. [[, Joystick.State.Axis.PropertyUri, Joystick.State.Axis.MinValue, Joystick.State.Axis.MaxValue, Joystick.State.Axis.Inverted, Joystick.State.Axis.Flip, Joystick.State.Axis.IsRemote);
else
- openspace.navigation.bindJoystickAxis("]] .. name .. "\", " .. axis .. [[, Joystick.State.Axis.Type, Joystick.State.Axis.Inverted, Joystick.State.Axis.JoystickType, Joystick.State.Axis.Sticky, Joystick.State.Axis.Sensitivity);
+ openspace.navigation.bindJoystickAxis("]] .. name .. "\", " .. axis .. [[, Joystick.State.Axis.Type, Joystick.State.Axis.Inverted, Joystick.State.Axis.JoystickType, Joystick.State.Axis.Sticky, Joystick.State.Axis.Flip, Joystick.State.Axis.Sensitivity);
end
]]
end
diff --git a/data/assets/util/joysticks/ps4.asset b/data/assets/util/joysticks/ps4.asset
index 770f138fcd..5ea6e25dbe 100644
--- a/data/assets/util/joysticks/ps4.asset
+++ b/data/assets/util/joysticks/ps4.asset
@@ -21,7 +21,8 @@ local joystickHelper = asset.require("./joystick_helper")
-- The axis values can either go back to 0 when the joystick is released or it can
-- stay at the value it was before the joystick was released.
-- The latter is called a sticky axis, when the values don't go back to 0.
--- Seventh parameter is the sensitivity for the axis
+-- Seventh parameter can be used to reverse the camera movement for the axis
+-- Eighth parameter is the sensitivity for the axis
local PS4Controller = {
LeftThumbStick = { 0 , 1 },
diff --git a/data/assets/util/joysticks/space-mouse-compact-wireless.asset b/data/assets/util/joysticks/space-mouse-compact-wireless.asset
index 2874aa23f2..f6326f9a4a 100644
--- a/data/assets/util/joysticks/space-mouse-compact-wireless.asset
+++ b/data/assets/util/joysticks/space-mouse-compact-wireless.asset
@@ -22,7 +22,8 @@ local joystickHelper = asset.require("./joystick_helper")
-- stay at the value it was before the joystick was released.
-- The latter is called a sticky axis, when the values don't go back to 0.
-- This version of the SpaceMouse IS Sticky.
--- Seventh parameter is the sensitivity for the axis
+-- Seventh parameter can be used to reverse the camera movement for the axis
+-- Eighth parameter is the sensitivity for the axis
local SpaceMouse = {
Push = {0, 1, 2}, -- left/right, back/forth, up/down
@@ -37,12 +38,12 @@ asset.onInitialize(function()
local controller = SpaceMouse;
local name = "3Dconnexion Universal Receiver";
- openspace.navigation.bindJoystickAxis(name, controller.Push[1], "Orbit X", false, "JoystickLike", true, 40.0);
- openspace.navigation.bindJoystickAxis(name, controller.Push[2], "Orbit Y", false, "JoystickLike", true, 40.0);
- openspace.navigation.bindJoystickAxis(name, controller.Twist[1], "Pan X", true, "JoystickLike", true, 40.0);
- openspace.navigation.bindJoystickAxis(name, controller.Tilt[2], "Pan Y", false, "JoystickLike", true, 35.0);
- openspace.navigation.bindJoystickAxis(name, controller.Push[3], "Zoom", false, "JoystickLike", true, 40.0);
- openspace.navigation.bindJoystickAxis(name, controller.Tilt[1], "LocalRoll X", false, "JoystickLike", true, 35.0);
+ openspace.navigation.bindJoystickAxis(name, controller.Push[1], "Orbit X", false, "JoystickLike", true, false, 40.0);
+ openspace.navigation.bindJoystickAxis(name, controller.Push[2], "Orbit Y", false, "JoystickLike", true, false, 40.0);
+ openspace.navigation.bindJoystickAxis(name, controller.Twist[1], "Pan X", true, "JoystickLike", true, false, 40.0);
+ openspace.navigation.bindJoystickAxis(name, controller.Tilt[2], "Pan Y", false, "JoystickLike", true, false, 35.0);
+ openspace.navigation.bindJoystickAxis(name, controller.Push[3], "Zoom", false, "JoystickLike", true, false, 40.0);
+ openspace.navigation.bindJoystickAxis(name, controller.Tilt[1], "LocalRoll X", false, "JoystickLike", true, false, 35.0);
openspace.navigation.bindJoystickButton(
name,
diff --git a/data/assets/util/joysticks/space-mouse-compact.asset b/data/assets/util/joysticks/space-mouse-compact.asset
index d9a2d13fed..09f0efb4a6 100644
--- a/data/assets/util/joysticks/space-mouse-compact.asset
+++ b/data/assets/util/joysticks/space-mouse-compact.asset
@@ -22,7 +22,8 @@ local joystickHelper = asset.require("./joystick_helper")
-- stay at the value it was before the joystick was released.
-- The latter is called a sticky axis, when the values don't go back to 0.
-- This version of the SpaceMouse IS Sticky.
--- Seventh parameter is the sensitivity for the axis
+-- Seventh parameter can be used to reverse the camera movement for the axis
+-- Eighth parameter is the sensitivity for the axis
local SpaceMouse = {
Push = {0, 1, 2}, -- left/right, back/forth, up/down
@@ -37,12 +38,12 @@ asset.onInitialize(function()
local controller = SpaceMouse;
local name = "SpaceNavigator";
- openspace.navigation.bindJoystickAxis(name, controller.Push[1], "Orbit X", false, "JoystickLike", true, 40.0);
- openspace.navigation.bindJoystickAxis(name, controller.Push[2], "Orbit Y", false, "JoystickLike", true, 40.0);
- openspace.navigation.bindJoystickAxis(name, controller.Twist[1], "Pan X", true, "JoystickLike", true, 40.0);
- openspace.navigation.bindJoystickAxis(name, controller.Tilt[2], "Pan Y", false, "JoystickLike", true, 35.0);
- openspace.navigation.bindJoystickAxis(name, controller.Push[3], "Zoom", false, "JoystickLike", true, 40.0);
- openspace.navigation.bindJoystickAxis(name, controller.Tilt[1], "LocalRoll X", false, "JoystickLike", true, 35.0);
+ openspace.navigation.bindJoystickAxis(name, controller.Push[1], "Orbit X", false, "JoystickLike", true, false, 40.0);
+ openspace.navigation.bindJoystickAxis(name, controller.Push[2], "Orbit Y", false, "JoystickLike", true, false, 40.0);
+ openspace.navigation.bindJoystickAxis(name, controller.Twist[1], "Pan X", true, "JoystickLike", true, false, 40.0);
+ openspace.navigation.bindJoystickAxis(name, controller.Tilt[2], "Pan Y", false, "JoystickLike", true, false, 35.0);
+ openspace.navigation.bindJoystickAxis(name, controller.Push[3], "Zoom", false, "JoystickLike", true, false, 40.0);
+ openspace.navigation.bindJoystickAxis(name, controller.Tilt[1], "LocalRoll X", false, "JoystickLike", true, false, 35.0);
openspace.navigation.bindJoystickButton(
name,
diff --git a/data/assets/util/joysticks/space-mouse-enterprise-wireless.asset b/data/assets/util/joysticks/space-mouse-enterprise-wireless.asset
index 2a8f124196..c8ec368afa 100644
--- a/data/assets/util/joysticks/space-mouse-enterprise-wireless.asset
+++ b/data/assets/util/joysticks/space-mouse-enterprise-wireless.asset
@@ -22,7 +22,8 @@ local joystickHelper = asset.require("./joystick_helper")
-- stay at the value it was before the joystick was released.
-- The latter is called a sticky axis, when the values don't go back to 0.
-- This version of the SpaceMouse is NOT Sticky.
--- Seventh parameter is the sensitivity for the axis
+-- Seventh parameter can be used to reverse the camera movement for the axis
+-- Eighth parameter is the sensitivity for the axis
local SpaceMouse = {
Push = {0, 1, 2}, -- left/right, back/forth, up/down
diff --git a/data/assets/util/joysticks/space-mouse-enterprise.asset b/data/assets/util/joysticks/space-mouse-enterprise.asset
index cb9510a641..354fa85e56 100644
--- a/data/assets/util/joysticks/space-mouse-enterprise.asset
+++ b/data/assets/util/joysticks/space-mouse-enterprise.asset
@@ -22,7 +22,8 @@ local joystickHelper = asset.require("./joystick_helper")
-- stay at the value it was before the joystick was released.
-- The latter is called a sticky axis, when the values don't go back to 0.
-- This version of the SpaceMouse is NOT Sticky.
--- Seventh parameter is the sensitivity for the axis
+-- Seventh parameter can be used to reverse the camera movement for the axis
+-- Eighth parameter is the sensitivity for the axis
local SpaceMouse = {
Push = {0, 1, 2}, -- left/right, back/forth, up/down
diff --git a/data/assets/util/joysticks/xbox-wireless.asset b/data/assets/util/joysticks/xbox-wireless.asset
index 0c98947505..64487a46e7 100644
--- a/data/assets/util/joysticks/xbox-wireless.asset
+++ b/data/assets/util/joysticks/xbox-wireless.asset
@@ -21,7 +21,8 @@ local joystickHelper = asset.require("./joystick_helper")
-- The axis values can either go back to 0 when the joystick is released or it can
-- stay at the value it was before the joystick was released.
-- The latter is called a sticky axis, when the values don't go back to 0.
--- Seventh parameter is the sensitivity for the axis
+-- Seventh parameter can be used to reverse the camera movement for the axis
+-- Eighth parameter is the sensitivity for the axis
local XBoxController = {
LeftThumbStick = { 0 , 1 },
diff --git a/data/assets/util/joysticks/xbox.asset b/data/assets/util/joysticks/xbox.asset
index 03685efbfe..93f76cb3c0 100644
--- a/data/assets/util/joysticks/xbox.asset
+++ b/data/assets/util/joysticks/xbox.asset
@@ -21,7 +21,8 @@ local joystickHelper = asset.require("./joystick_helper")
-- The axis values can either go back to 0 when the joystick is released or it can
-- stay at the value it was before the joystick was released.
-- The latter is called a sticky axis, when the values don't go back to 0.
--- Seventh parameter is the sensitivity for the axis
+-- Seventh parameter can be used to reverse the camera movement for the axis
+-- Eighth parameter is the sensitivity for the axis
local XBoxController = {
LeftThumbStick = { 0 , 1 },
diff --git a/include/openspace/interaction/joystickcamerastates.h b/include/openspace/interaction/joystickcamerastates.h
index 214ef79007..6bb61b1967 100644
--- a/include/openspace/interaction/joystickcamerastates.h
+++ b/include/openspace/interaction/joystickcamerastates.h
@@ -60,11 +60,13 @@ public:
BooleanType(AxisInvert);
BooleanType(ButtonCommandRemote);
+ BooleanType(AxisFlip);
struct AxisInformation {
AxisType type = AxisType::None;
AxisInvert invert = AxisInvert::No;
JoystickType joystickType = JoystickType::JoystickLike;
+ AxisFlip flip = AxisFlip::No;
// The axis values can either go back to 0 when the joystick is released or it can
// stay at the value it was before the joystick was released.
@@ -91,12 +93,14 @@ public:
void setAxisMapping(std::string joystickName, int axis, AxisType mapping,
AxisInvert shouldInvert = AxisInvert::No,
JoystickType joystickType = JoystickType::JoystickLike,
- bool isSticky = false, double sensitivity = 0.0
+ bool isSticky = false, AxisFlip shouldFlip = AxisFlip::No,
+ double sensitivity = 0.0
);
void setAxisMappingProperty(std::string joystickName, int axis,
std::string propertyUri, float min = 0.f, float max = 1.f,
- AxisInvert shouldInvert = AxisInvert::No, bool isRemote = true
+ AxisInvert shouldInvert = AxisInvert::No, AxisFlip shouldFlip = AxisFlip::No,
+ bool isRemote = true
);
AxisInformation axisMapping(const std::string& joystickName, int axis) const;
diff --git a/include/openspace/navigation/navigationhandler.h b/include/openspace/navigation/navigationhandler.h
index ea2fdfcb44..0451567017 100644
--- a/include/openspace/navigation/navigationhandler.h
+++ b/include/openspace/navigation/navigationhandler.h
@@ -105,15 +105,17 @@ public:
JoystickCameraStates::AxisInvert::No,
JoystickCameraStates::JoystickType joystickType =
JoystickCameraStates::JoystickType::JoystickLike,
- bool isSticky = false, double sensitivity = 0.0
- );
+ bool isSticky = false,
+ JoystickCameraStates::AxisFlip shouldFlip = JoystickCameraStates::AxisFlip::No,
+ double sensitivity = 0.0);
void setJoystickAxisMappingProperty(std::string joystickName,
int axis, std::string propertyUri,
float min = 0.f, float max = 1.f,
JoystickCameraStates::AxisInvert shouldInvert =
- JoystickCameraStates::AxisInvert::No, bool isRemote = true
- );
+ JoystickCameraStates::AxisInvert::No,
+ JoystickCameraStates::AxisFlip shouldFlip = JoystickCameraStates::AxisFlip::No,
+ bool isRemote = true);
JoystickCameraStates::AxisInformation joystickAxisMapping(
const std::string& joystickName, int axis) const;
diff --git a/src/interaction/joystickcamerastates.cpp b/src/interaction/joystickcamerastates.cpp
index 0ca0273b6a..ef61b067de 100644
--- a/src/interaction/joystickcamerastates.cpp
+++ b/src/interaction/joystickcamerastates.cpp
@@ -121,6 +121,10 @@ void JoystickCameraStates::updateStateFromInput(
}
}
+ if (t.flip) {
+ value = -value;
+ }
+
switch (t.type) {
case AxisType::None:
break;
@@ -242,6 +246,7 @@ void JoystickCameraStates::setAxisMapping(std::string joystickName,
AxisInvert shouldInvert,
JoystickType joystickType,
bool isSticky,
+ AxisFlip shouldFlip,
double sensitivity)
{
JoystickCameraState* joystickCameraState = findOrAddJoystickCameraState(joystickName);
@@ -259,6 +264,7 @@ void JoystickCameraStates::setAxisMapping(std::string joystickName,
joystickCameraState->axisMapping[axis].invert = shouldInvert;
joystickCameraState->axisMapping[axis].joystickType = joystickType;
joystickCameraState->axisMapping[axis].isSticky = isSticky;
+ joystickCameraState->axisMapping[axis].flip = shouldFlip;
joystickCameraState->axisMapping[axis].sensitivity = sensitivity;
joystickCameraState->prevAxisValues[axis] =
@@ -270,6 +276,7 @@ void JoystickCameraStates::setAxisMappingProperty(std::string joystickName,
std::string propertyUri,
float min, float max,
AxisInvert shouldInvert,
+ AxisFlip shouldFlip,
bool isRemote)
{
JoystickCameraState* joystickCameraState = findOrAddJoystickCameraState(joystickName);
@@ -285,6 +292,7 @@ void JoystickCameraStates::setAxisMappingProperty(std::string joystickName,
joystickCameraState->axisMapping[axis].type = AxisType::Property;
joystickCameraState->axisMapping[axis].invert = shouldInvert;
+ joystickCameraState->axisMapping[axis].flip = shouldFlip;
joystickCameraState->axisMapping[axis].propertyUri = propertyUri;
joystickCameraState->axisMapping[axis].minValue = min;
joystickCameraState->axisMapping[axis].maxValue = max;
diff --git a/src/navigation/navigationhandler.cpp b/src/navigation/navigationhandler.cpp
index 4134e9ff47..40dda9a57b 100644
--- a/src/navigation/navigationhandler.cpp
+++ b/src/navigation/navigationhandler.cpp
@@ -524,6 +524,7 @@ void NavigationHandler::setJoystickAxisMapping(std::string joystickName, int axi
JoystickCameraStates::AxisInvert shouldInvert,
JoystickCameraStates::JoystickType joystickType,
bool isSticky,
+ JoystickCameraStates::AxisFlip shouldFlip,
double sensitivity)
{
_orbitalNavigator.joystickStates().setAxisMapping(
@@ -533,6 +534,7 @@ void NavigationHandler::setJoystickAxisMapping(std::string joystickName, int axi
shouldInvert,
joystickType,
isSticky,
+ shouldFlip,
sensitivity
);
}
@@ -542,6 +544,7 @@ void NavigationHandler::setJoystickAxisMappingProperty(std::string joystickName,
std::string propertyUri,
float min, float max,
JoystickCameraStates::AxisInvert shouldInvert,
+ JoystickCameraStates::AxisFlip shouldFlip,
bool isRemote)
{
_orbitalNavigator.joystickStates().setAxisMappingProperty(
@@ -551,6 +554,7 @@ void NavigationHandler::setJoystickAxisMappingProperty(std::string joystickName,
min,
max,
shouldInvert,
+ shouldFlip,
isRemote
);
}
diff --git a/src/navigation/navigationhandler_lua.inl b/src/navigation/navigationhandler_lua.inl
index e9fa215803..e15d546370 100644
--- a/src/navigation/navigationhandler_lua.inl
+++ b/src/navigation/navigationhandler_lua.inl
@@ -169,12 +169,24 @@ namespace {
* 'isSticky' is 'true', the value is calculated relative to the previous value. If
* 'sensitivity' is given then that value will affect the sensitivity of the axis together
* with the global sensitivity.
+ *
+ * \param joystickName the name for the joystick or game controller that should be bound
+ * \param axis the axis of the joystick that should be bound
+ * \param axisType the type of movement that the axis should be mapped to
+ * \param shouldInvert if the joystick movement should be inverted or not
+ * \param joystickType what type of joystick or axis this is. Either
+ * "JoystickLike" or "TriggerLike".
+ * \param isSticky if true, the value is calculated relative to the previous value,
+ * if false the the value is used as is.
+ * \param shouldFlip reverses the movement of the camera that the joystick produces
+ * \param sensitivity sensitivity for this axis
*/
[[codegen::luawrap]] void bindJoystickAxis(std::string joystickName, int axis,
std::string axisType,
bool shouldInvert = false,
std::string joystickType = "JoystickLike",
bool isSticky = false,
+ bool shouldFlip = false,
double sensitivity = 0.0)
{
using namespace openspace;
@@ -186,6 +198,7 @@ namespace {
JoystickCameraStates::AxisInvert(shouldInvert),
ghoul::from_string(joystickType),
isSticky,
+ JoystickCameraStates::AxisFlip(shouldFlip),
sensitivity
);
}
@@ -197,21 +210,34 @@ namespace {
* value is rescaled from [-1, 1] to [min, max], default is [0, 1]. If 'isInverted' is
* 'true', the axis value is inverted. The last argument determines whether the property
* change is going to be executed locally or remotely, where the latter is the default.
+ *
+ * \param joystickName the name for the joystick or game controller that should be bound
+ * \param axis the axis of the joystick that should be bound
+ * \param propertyUri the property that this joystick axis should modify
+ * \param min the minimum value that this axis can set for the property
+ * \param max the maximum value that this axis can set for the property
+ * \param shouldInvert if the joystick movement should be inverted or not
+ * \param shouldFlip reverses the movement of the camera that the joystick produces
+ * \param isRemote if true, the property change will also be executed on connected nodes
+ * if false, the property change will only affect the master node
*/
[[codegen::luawrap]] void bindJoystickAxisProperty(std::string joystickName, int axis,
std::string propertyUri,
float min = 0.f, float max = 1.f,
bool shouldInvert = false,
+ bool shouldFlip = false,
bool isRemote = true)
{
using namespace openspace;
+ using JoystickCameraStates = interaction::JoystickCameraStates;
global::navigationHandler->setJoystickAxisMappingProperty(
std::move(joystickName),
axis,
std::move(propertyUri),
min,
max,
- interaction::JoystickCameraStates::AxisInvert(shouldInvert),
+ JoystickCameraStates::AxisInvert(shouldInvert),
+ JoystickCameraStates::AxisFlip(shouldFlip),
isRemote
);
}
@@ -226,7 +252,7 @@ namespace {
* bool.
*/
[[codegen::luawrap]]
-std::tuple
+std::tuple
joystickAxis(std::string joystickName, int axis)
{
using namespace openspace;
@@ -239,6 +265,7 @@ joystickAxis(std::string joystickName, int axis)
info.invert,
ghoul::to_string(info.joystickType),
info.isSticky,
+ info.flip,
info.sensitivity,
info.propertyUri,
info.minValue,