mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-07 20:21:24 -06:00
@@ -25,8 +25,8 @@
|
||||
-- First - Name of the joystick that should be bound
|
||||
-- Second - Which axis should be bound of this joystick
|
||||
-- Third - The property uri
|
||||
-- Fourth - (optional) The smallest value that you wnat to allow this property on the joystick
|
||||
-- Fifth - (optional) The largest value that you wnat to allow this property on the joystick
|
||||
-- Fourth - (optional) The smallest value that you want to allow this property on the joystick
|
||||
-- Fifth - (optional) The largest value that you want to allow this property on the joystick
|
||||
-- Sixth - (optional) Determines whether the axis should be inverted
|
||||
-- Seventh - (optional) Should this property change be sent to other connected remote sessions
|
||||
|
||||
|
||||
72
data/assets/util/joysticks/any-joystick.asset
Normal file
72
data/assets/util/joysticks/any-joystick.asset
Normal file
@@ -0,0 +1,72 @@
|
||||
local propertyHelper = asset.require("../property_helper")
|
||||
local joystickHelper = asset.require("./joystick_helper")
|
||||
local initializeAll = false
|
||||
|
||||
-- Add the asset cooresponding to the joystick name
|
||||
local function addJoystickAsset(joystick)
|
||||
if joystick == "Wireless Controller" then
|
||||
openspace.asset.add("./util/joysticks/ps4")
|
||||
elseif joystick == "Xbox Controller" then
|
||||
openspace.asset.add("./util/joysticks/xbox")
|
||||
elseif joystick == "Wireless Xbox Controller" then
|
||||
openspace.asset.add("./util/joysticks/xbox-wireless")
|
||||
elseif joystick == "SpaceNavigator" then
|
||||
openspace.asset.add("./util/joysticks/space-mouse-compact")
|
||||
elseif joystick == "SpaceMouse Enterprise" then
|
||||
openspace.asset.add("./util/joysticks/space-mouse-enterprise")
|
||||
elseif joystick == "3Dconnexion Universal Receiver" then
|
||||
openspace.printWarning("SpaceMouse in wireless mode cannot be automatically detected and added. Please add the matching asset file manually.")
|
||||
else
|
||||
openspace.printWarning("Could not find a matching asset for joystick: " .. joystick)
|
||||
end
|
||||
end
|
||||
|
||||
asset.onInitialize(function()
|
||||
local rawJoysticks = openspace.navigation.listAllJoysticks()
|
||||
local numJoysticks = #rawJoysticks
|
||||
local joystick = ""
|
||||
|
||||
-- Remove the SpaceMouse emulator if it exists
|
||||
local joysticks = {}
|
||||
for _, joyStickName in ipairs(rawJoysticks) do
|
||||
if joyStickName == "3Dconnexion KMJ Emulator" then
|
||||
numJoysticks = numJoysticks - 1
|
||||
else
|
||||
table.insert(joysticks, joyStickName)
|
||||
end
|
||||
end
|
||||
|
||||
if numJoysticks == 0 then
|
||||
openspace.printWarning("Could not find any connected joysticks")
|
||||
elseif numJoysticks == 1 then
|
||||
addJoystickAsset(joysticks[1])
|
||||
elseif numJoysticks > 1 and initializeAll then
|
||||
for _, joyStickName in ipairs(joysticks) do
|
||||
addJoystickAsset(joyStickName)
|
||||
end
|
||||
else
|
||||
openspace.printWarning("Cannot auto detect and add several joysticks")
|
||||
end
|
||||
end)
|
||||
|
||||
asset.onDeinitialize(function()
|
||||
if openspace.asset.isLoaded("./util/joysticks/ps4") then
|
||||
openspace.asset.remove("./util/joysticks/ps4")
|
||||
end
|
||||
|
||||
if openspace.asset.isLoaded("./util/joysticks/xbox") then
|
||||
openspace.asset.remove("./util/joysticks/xbox")
|
||||
end
|
||||
|
||||
if openspace.asset.isLoaded("./util/joysticks/xbox-wireless") then
|
||||
openspace.asset.remove("./util/joysticks/xbox-wireless")
|
||||
end
|
||||
|
||||
if openspace.asset.isLoaded("./util/joysticks/space-mouse-compact") then
|
||||
openspace.asset.remove("./util/joysticks/space-mouse-compact")
|
||||
end
|
||||
|
||||
if openspace.asset.isLoaded("./util/joysticks/space-mouse-enterprise") then
|
||||
openspace.asset.remove("./util/joysticks/space-mouse-enterprise")
|
||||
end
|
||||
end)
|
||||
@@ -63,8 +63,27 @@ local unbindRoll = function(name, axis)
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
-- Function that will find the first connected joystick with a name that matches one of
|
||||
-- the given possible names
|
||||
local findJoystick = function(possibleNames)
|
||||
-- Will only catch the joysticks that are connected before start up
|
||||
local joysticks = openspace.navigation.listAllJoysticks()
|
||||
|
||||
for _, joyStickName in ipairs(joysticks) do
|
||||
for _, name in ipairs(possibleNames) do
|
||||
if joyStickName == name then
|
||||
return name
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return nil
|
||||
end
|
||||
|
||||
asset.export("bindLocalRoll", bindLocalRoll)
|
||||
asset.export("bindGlobalRoll", bindGlobalRoll)
|
||||
asset.export("permaBindLocalRoll", permaBindLocalRoll)
|
||||
asset.export("permaBindGlobalRoll", permaBindGlobalRoll)
|
||||
asset.export("unbindRoll", unbindRoll)
|
||||
asset.export("findJoystick", findJoystick)
|
||||
|
||||
@@ -52,12 +52,14 @@ asset.onInitialize(function()
|
||||
local controller = PS4Controller;
|
||||
local name = "Wireless Controller";
|
||||
|
||||
openspace.navigation.setAxisDeadZone(name, controller.LeftThumbStick[1], 0.15)
|
||||
openspace.navigation.setAxisDeadZone(name, controller.LeftThumbStick[2], 0.15)
|
||||
openspace.navigation.setAxisDeadZone(name, controller.RightThumbStick[1], 0.15)
|
||||
openspace.navigation.setAxisDeadZone(name, controller.RightThumbStick[2], 0.15)
|
||||
openspace.navigation.setAxisDeadZone(name, controller.L2, 0.05)
|
||||
openspace.navigation.setAxisDeadZone(name, controller.R2, 0.05)
|
||||
local deadzoneJoysticks = 0.15
|
||||
local deadzoneTriggers = 0.05
|
||||
openspace.navigation.setAxisDeadZone(name, controller.LeftThumbStick[1], deadzoneJoysticks)
|
||||
openspace.navigation.setAxisDeadZone(name, controller.LeftThumbStick[2], deadzoneJoysticks)
|
||||
openspace.navigation.setAxisDeadZone(name, controller.RightThumbStick[1], deadzoneJoysticks)
|
||||
openspace.navigation.setAxisDeadZone(name, controller.RightThumbStick[2], deadzoneJoysticks)
|
||||
openspace.navigation.setAxisDeadZone(name, controller.L2, deadzoneTriggers)
|
||||
openspace.navigation.setAxisDeadZone(name, controller.R2, deadzoneTriggers)
|
||||
|
||||
openspace.navigation.bindJoystickAxis(name, controller.LeftThumbStick[1], "Orbit X");
|
||||
openspace.navigation.bindJoystickAxis(name, controller.LeftThumbStick[2], "Orbit Y", true);
|
||||
@@ -116,9 +118,9 @@ asset.onInitialize(function()
|
||||
name,
|
||||
controller.Square,
|
||||
[[
|
||||
"openspace.setPropertyValueSingle("NavigationHandler.OrbitalNavigator.Aim", "");
|
||||
"openspace.setPropertyValueSingle("NavigationHandler.OrbitalNavigator.Anchor", "Earth");
|
||||
"openspace.setPropertyValueSingle("NavigationHandler.OrbitalNavigator.RetargetAnchor", nil);
|
||||
openspace.setPropertyValueSingle("NavigationHandler.OrbitalNavigator.Aim", "");
|
||||
openspace.setPropertyValueSingle("NavigationHandler.OrbitalNavigator.Anchor", "Earth");
|
||||
openspace.setPropertyValueSingle("NavigationHandler.OrbitalNavigator.RetargetAnchor", nil);
|
||||
]],
|
||||
"Switch target to Earth"
|
||||
)
|
||||
|
||||
@@ -21,27 +21,28 @@ 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.
|
||||
-- This version of the SpaceMouse is NOT Sticky.
|
||||
-- This version of the SpaceMouse IS Sticky.
|
||||
-- Seventh parameter is the sensitivity for the axis
|
||||
|
||||
local SpaceMouse = {
|
||||
Push = {0, 1, 2}, -- left/right, back/forth, up/down
|
||||
Twist = {5}, -- left/right
|
||||
Tilt = {4, 3}, -- left/right, back/forth
|
||||
|
||||
LeftButton = 0,
|
||||
RightButton = 1
|
||||
}
|
||||
|
||||
asset.onInitialize(function()
|
||||
local controller = SpaceMouse;
|
||||
local name = "SpaceNavigator";
|
||||
local name = "3Dconnexion Universal Receiver";
|
||||
|
||||
openspace.navigation.bindJoystickAxis(name, controller.Push[1], "Orbit X");
|
||||
openspace.navigation.bindJoystickAxis(name, controller.Push[2], "Orbit Y");
|
||||
openspace.navigation.bindJoystickAxis(name, controller.Twist[1], "Pan X", true);
|
||||
openspace.navigation.bindJoystickAxis(name, controller.Tilt[2], "Pan Y");
|
||||
openspace.navigation.bindJoystickAxis(name, controller.Push[3], "Zoom");
|
||||
openspace.navigation.bindJoystickAxis(name, controller.Tilt[1], "LocalRoll X");
|
||||
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.bindJoystickButton(
|
||||
name,
|
||||
@@ -28,6 +28,7 @@ local SpaceMouse = {
|
||||
Push = {0, 1, 2}, -- left/right, back/forth, up/down
|
||||
Twist = {5}, -- left/right
|
||||
Tilt = {4, 3}, -- left/right, back/forth
|
||||
|
||||
LeftButton = 0,
|
||||
RightButton = 1
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
local propertyHelper = asset.require("../property_helper")
|
||||
local joystickHelper = asset.require("./joystick_helper")
|
||||
|
||||
-- Allowed values for the third parameter of bindJoystickAxis:
|
||||
-- "None"
|
||||
-- "Orbit X"
|
||||
-- "Orbit Y"
|
||||
-- "Zoom" -- both in and out
|
||||
-- "Zoom In"
|
||||
-- "Zoom Out"
|
||||
-- "LocalRoll X"
|
||||
-- "LocalRoll Y"
|
||||
-- "GlobalRoll X"
|
||||
-- "GlobalRoll Y"
|
||||
-- "Pan X"
|
||||
-- "Pan Y"
|
||||
-- Fourth parameter determines whether the axis should be inverted
|
||||
-- Fifth parameter determines whether the axis behaves like a joystick or a Trigger.
|
||||
-- Allowed values are "JoystickLike" and "TriggerLike", the first one is the default
|
||||
-- Sixth parameters determins if the axis should be "Sticky" or not.
|
||||
-- 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.
|
||||
-- This version of the SpaceMouse is NOT Sticky.
|
||||
-- Seventh parameter is the sensitivity for the axis
|
||||
|
||||
local SpaceMouse = {
|
||||
Push = {0, 1, 2}, -- left/right, back/forth, up/down
|
||||
Twist = {5}, -- left/right
|
||||
Tilt = {4, 3}, -- left/right, back/forth
|
||||
|
||||
-- Buttons on the Enterprise version of the SpaceMouse is not detectable, use regular
|
||||
-- keybindings instead, for more information see our wiki page.
|
||||
}
|
||||
|
||||
asset.onInitialize(function()
|
||||
local controller = SpaceMouse;
|
||||
local name = "3Dconnexion Universal Receiver";
|
||||
|
||||
local deadzone = 0.15
|
||||
openspace.navigation.setAxisDeadZone(name, controller.Push[1], deadzone)
|
||||
openspace.navigation.setAxisDeadZone(name, controller.Push[2], deadzone)
|
||||
openspace.navigation.setAxisDeadZone(name, controller.Twist[1], deadzone)
|
||||
openspace.navigation.setAxisDeadZone(name, controller.Tilt[2], deadzone)
|
||||
openspace.navigation.setAxisDeadZone(name, controller.Push[3], deadzone)
|
||||
openspace.navigation.setAxisDeadZone(name, controller.Tilt[1], deadzone)
|
||||
|
||||
openspace.navigation.bindJoystickAxis(name, controller.Push[1], "Orbit X");
|
||||
openspace.navigation.bindJoystickAxis(name, controller.Push[2], "Orbit Y");
|
||||
openspace.navigation.bindJoystickAxis(name, controller.Twist[1], "Pan X", true);
|
||||
openspace.navigation.bindJoystickAxis(name, controller.Tilt[2], "Pan Y");
|
||||
openspace.navigation.bindJoystickAxis(name, controller.Push[3], "Zoom");
|
||||
openspace.navigation.bindJoystickAxis(name, controller.Tilt[1], "LocalRoll X");
|
||||
end)
|
||||
54
data/assets/util/joysticks/space-mouse-enterprise.asset
Normal file
54
data/assets/util/joysticks/space-mouse-enterprise.asset
Normal file
@@ -0,0 +1,54 @@
|
||||
local propertyHelper = asset.require("../property_helper")
|
||||
local joystickHelper = asset.require("./joystick_helper")
|
||||
|
||||
-- Allowed values for the third parameter of bindJoystickAxis:
|
||||
-- "None"
|
||||
-- "Orbit X"
|
||||
-- "Orbit Y"
|
||||
-- "Zoom" -- both in and out
|
||||
-- "Zoom In"
|
||||
-- "Zoom Out"
|
||||
-- "LocalRoll X"
|
||||
-- "LocalRoll Y"
|
||||
-- "GlobalRoll X"
|
||||
-- "GlobalRoll Y"
|
||||
-- "Pan X"
|
||||
-- "Pan Y"
|
||||
-- Fourth parameter determines whether the axis should be inverted
|
||||
-- Fifth parameter determines whether the axis behaves like a joystick or a Trigger.
|
||||
-- Allowed values are "JoystickLike" and "TriggerLike", the first one is the default
|
||||
-- Sixth parameters determins if the axis should be "Sticky" or not.
|
||||
-- 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.
|
||||
-- This version of the SpaceMouse is NOT Sticky.
|
||||
-- Seventh parameter is the sensitivity for the axis
|
||||
|
||||
local SpaceMouse = {
|
||||
Push = {0, 1, 2}, -- left/right, back/forth, up/down
|
||||
Twist = {5}, -- left/right
|
||||
Tilt = {4, 3}, -- left/right, back/forth
|
||||
|
||||
-- Buttons on the Enterprise version of the SpaceMouse is not detectable, use regular
|
||||
-- keybindings instead, for more information see our wiki page.
|
||||
}
|
||||
|
||||
asset.onInitialize(function()
|
||||
local controller = SpaceMouse;
|
||||
local name = "SpaceMouse Enterprise";
|
||||
|
||||
local deadzone = 0.15
|
||||
openspace.navigation.setAxisDeadZone(name, controller.Push[1], deadzone)
|
||||
openspace.navigation.setAxisDeadZone(name, controller.Push[2], deadzone)
|
||||
openspace.navigation.setAxisDeadZone(name, controller.Twist[1], deadzone)
|
||||
openspace.navigation.setAxisDeadZone(name, controller.Tilt[2], deadzone)
|
||||
openspace.navigation.setAxisDeadZone(name, controller.Push[3], deadzone)
|
||||
openspace.navigation.setAxisDeadZone(name, controller.Tilt[1], deadzone)
|
||||
|
||||
openspace.navigation.bindJoystickAxis(name, controller.Push[1], "Orbit X");
|
||||
openspace.navigation.bindJoystickAxis(name, controller.Push[2], "Orbit Y");
|
||||
openspace.navigation.bindJoystickAxis(name, controller.Twist[1], "Pan X", true);
|
||||
openspace.navigation.bindJoystickAxis(name, controller.Tilt[2], "Pan Y");
|
||||
openspace.navigation.bindJoystickAxis(name, controller.Push[3], "Zoom");
|
||||
openspace.navigation.bindJoystickAxis(name, controller.Tilt[1], "LocalRoll X");
|
||||
end)
|
||||
135
data/assets/util/joysticks/xbox-wireless.asset
Normal file
135
data/assets/util/joysticks/xbox-wireless.asset
Normal file
@@ -0,0 +1,135 @@
|
||||
local propertyHelper = asset.require("../property_helper")
|
||||
local joystickHelper = asset.require("./joystick_helper")
|
||||
|
||||
-- Allowed values for the third parameter of bindJoystickAxis:
|
||||
-- "None"
|
||||
-- "Orbit X"
|
||||
-- "Orbit Y"
|
||||
-- "Zoom" -- both in and out
|
||||
-- "Zoom In"
|
||||
-- "Zoom Out"
|
||||
-- "LocalRoll X"
|
||||
-- "LocalRoll Y"
|
||||
-- "GlobalRoll X"
|
||||
-- "GlobalRoll Y"
|
||||
-- "Pan X"
|
||||
-- "Pan Y"
|
||||
-- Fourth parameter determines whether the axis should be inverted
|
||||
-- Fifth parameter determines whether the axis behaves like a joystick or a Trigger.
|
||||
-- Allowed values are "JoystickLike" and "TriggerLike", the first one is the default
|
||||
-- Sixth parameters determins if the axis should be "Sticky" or not.
|
||||
-- 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
|
||||
|
||||
local XBoxController = {
|
||||
LeftThumbStick = { 0 , 1 },
|
||||
RightThumbStick = { 2, 3 },
|
||||
LeftTrigger = 4,
|
||||
RightTrigger = 5,
|
||||
A = 0,
|
||||
B = 1,
|
||||
X = 2,
|
||||
Y = 3,
|
||||
LB = 4,
|
||||
RB = 5,
|
||||
Select = 6,
|
||||
Start = 7,
|
||||
LeftStickButton = 8,
|
||||
RightStickButton = 9,
|
||||
DPad = {
|
||||
Up = 10,
|
||||
Right = 11,
|
||||
Down = 12,
|
||||
Left = 13
|
||||
}
|
||||
}
|
||||
|
||||
asset.onInitialize(function()
|
||||
local controller = XBoxController;
|
||||
local name = "Wireless Xbox Controller";
|
||||
|
||||
local deadzoneJoysticks = 0.15
|
||||
local deadzoneTriggers = 0.05
|
||||
openspace.navigation.setAxisDeadZone(name, controller.LeftThumbStick[1], deadzoneJoysticks)
|
||||
openspace.navigation.setAxisDeadZone(name, controller.LeftThumbStick[2], deadzoneJoysticks)
|
||||
openspace.navigation.setAxisDeadZone(name, controller.RightThumbStick[1], deadzoneJoysticks)
|
||||
openspace.navigation.setAxisDeadZone(name, controller.RightThumbStick[2], deadzoneJoysticks)
|
||||
openspace.navigation.setAxisDeadZone(name, controller.LeftTrigger, deadzoneTriggers)
|
||||
openspace.navigation.setAxisDeadZone(name, controller.RightTrigger, deadzoneTriggers)
|
||||
|
||||
openspace.navigation.bindJoystickAxis(name, controller.LeftThumbStick[1], "Orbit X");
|
||||
openspace.navigation.bindJoystickAxis(name, controller.LeftThumbStick[2], "Orbit Y", true);
|
||||
openspace.navigation.bindJoystickAxis(name, controller.RightThumbStick[1], "Pan X", true);
|
||||
openspace.navigation.bindJoystickAxis(name, controller.RightThumbStick[2], "Pan Y", true);
|
||||
openspace.navigation.bindJoystickAxis(name, controller.LeftTrigger, "Zoom Out", false, "TriggerLike");
|
||||
openspace.navigation.bindJoystickAxis(name, controller.RightTrigger, "Zoom In", false, "TriggerLike");
|
||||
|
||||
openspace.navigation.bindJoystickButton(
|
||||
name,
|
||||
controller.LB,
|
||||
joystickHelper.bindLocalRoll(name, controller.RightThumbStick[1]),
|
||||
"Switch to local roll mode"
|
||||
)
|
||||
openspace.navigation.bindJoystickButton(
|
||||
name,
|
||||
controller.LB,
|
||||
joystickHelper.unbindRoll(name, controller.RightThumbStick[1]),
|
||||
"Switch back to normal mode",
|
||||
"Release"
|
||||
)
|
||||
openspace.navigation.bindJoystickButton(
|
||||
name,
|
||||
controller.RB,
|
||||
joystickHelper.bindGlobalRoll(name, controller.RightThumbStick[1]),
|
||||
"Switch to global roll mode"
|
||||
)
|
||||
openspace.navigation.bindJoystickButton(
|
||||
name,
|
||||
controller.RB,
|
||||
joystickHelper.unbindRoll(name, controller.RightThumbStick[1]),
|
||||
"Switch back to normal mode",
|
||||
"Release"
|
||||
)
|
||||
|
||||
openspace.navigation.bindJoystickButton(
|
||||
name,
|
||||
controller.A,
|
||||
propertyHelper.invert("NavigationHandler.OrbitalNavigator.Friction.ZoomFriction"),
|
||||
"Toggle zoom friction"
|
||||
)
|
||||
openspace.navigation.bindJoystickButton(
|
||||
name,
|
||||
controller.B,
|
||||
propertyHelper.invert("NavigationHandler.OrbitalNavigator.Friction.RotationalFriction"),
|
||||
"Toggle rotational friction"
|
||||
)
|
||||
openspace.navigation.bindJoystickButton(
|
||||
name,
|
||||
controller.DPad.Left,
|
||||
propertyHelper.invert("NavigationHandler.OrbitalNavigator.Friction.RollFriction"),
|
||||
"Toggle roll friction"
|
||||
)
|
||||
|
||||
openspace.navigation.bindJoystickButton(
|
||||
name,
|
||||
controller.X,
|
||||
[[
|
||||
openspace.setPropertyValueSingle("NavigationHandler.OrbitalNavigator.Aim", "");
|
||||
openspace.setPropertyValueSingle("NavigationHandler.OrbitalNavigator.Anchor", "Earth");
|
||||
openspace.setPropertyValueSingle("NavigationHandler.OrbitalNavigator.RetargetAnchor", nil);
|
||||
]],
|
||||
"Switch target to Earth"
|
||||
)
|
||||
openspace.navigation.bindJoystickButton(
|
||||
name,
|
||||
controller.Y,
|
||||
[[
|
||||
openspace.setPropertyValueSingle("NavigationHandler.OrbitalNavigator.Aim", "");
|
||||
openspace.setPropertyValueSingle("NavigationHandler.OrbitalNavigator.Anchor", "Mars");
|
||||
openspace.setPropertyValueSingle("NavigationHandler.OrbitalNavigator.RetargetAnchor", nil);
|
||||
]],
|
||||
"Switch target to Mars"
|
||||
)
|
||||
end)
|
||||
@@ -50,12 +50,14 @@ asset.onInitialize(function()
|
||||
local controller = XBoxController;
|
||||
local name = "Xbox Controller";
|
||||
|
||||
openspace.navigation.setAxisDeadZone(name, controller.LeftThumbStick[1], 0.15)
|
||||
openspace.navigation.setAxisDeadZone(name, controller.LeftThumbStick[2], 0.15)
|
||||
openspace.navigation.setAxisDeadZone(name, controller.RightThumbStick[1], 0.15)
|
||||
openspace.navigation.setAxisDeadZone(name, controller.RightThumbStick[2], 0.15)
|
||||
openspace.navigation.setAxisDeadZone(name, controller.LeftTrigger, 0.05)
|
||||
openspace.navigation.setAxisDeadZone(name, controller.RightTrigger, 0.05)
|
||||
local deadzoneJoysticks = 0.15
|
||||
local deadzoneTriggers = 0.05
|
||||
openspace.navigation.setAxisDeadZone(name, controller.LeftThumbStick[1], deadzoneJoysticks)
|
||||
openspace.navigation.setAxisDeadZone(name, controller.LeftThumbStick[2], deadzoneJoysticks)
|
||||
openspace.navigation.setAxisDeadZone(name, controller.RightThumbStick[1], deadzoneJoysticks)
|
||||
openspace.navigation.setAxisDeadZone(name, controller.RightThumbStick[2], deadzoneJoysticks)
|
||||
openspace.navigation.setAxisDeadZone(name, controller.LeftTrigger, deadzoneTriggers)
|
||||
openspace.navigation.setAxisDeadZone(name, controller.RightTrigger, deadzoneTriggers)
|
||||
|
||||
openspace.navigation.bindJoystickAxis(name, controller.LeftThumbStick[1], "Orbit X");
|
||||
openspace.navigation.bindJoystickAxis(name, controller.LeftThumbStick[2], "Orbit Y", true);
|
||||
@@ -114,9 +116,9 @@ asset.onInitialize(function()
|
||||
name,
|
||||
controller.X,
|
||||
[[
|
||||
"openspace.setPropertyValueSingle("NavigationHandler.OrbitalNavigator.Aim", "");
|
||||
"openspace.setPropertyValueSingle("NavigationHandler.OrbitalNavigator.Anchor", "Earth");
|
||||
"openspace.setPropertyValueSingle("NavigationHandler.OrbitalNavigator.RetargetAnchor", nil);
|
||||
openspace.setPropertyValueSingle("NavigationHandler.OrbitalNavigator.Aim", "");
|
||||
openspace.setPropertyValueSingle("NavigationHandler.OrbitalNavigator.Anchor", "Earth");
|
||||
openspace.setPropertyValueSingle("NavigationHandler.OrbitalNavigator.RetargetAnchor", nil);
|
||||
]],
|
||||
"Switch target to Earth"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user