mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-05 19:19:39 -06:00
Some simplifications to joystick assets
This commit is contained in:
@@ -30,17 +30,26 @@
|
||||
-- Seventh - (optional) Should this property change be sent to other connected remote sessions
|
||||
|
||||
local XBoxController = {
|
||||
LeftThumbStick = { 0 , 1 },
|
||||
RightThumbStick = { 2, 3 },
|
||||
-- Axes
|
||||
LeftThumbStick = {
|
||||
LeftRight = 0,
|
||||
UpDown = 1
|
||||
},
|
||||
RightThumbStick = {
|
||||
LeftRight = 2,
|
||||
UpDown = 3
|
||||
},
|
||||
LeftTrigger = 4,
|
||||
RightTrigger = 5,
|
||||
|
||||
-- Buttons
|
||||
A = 0,
|
||||
B = 1,
|
||||
X = 2,
|
||||
Y = 3,
|
||||
LB = 4,
|
||||
RB = 5,
|
||||
Select = 6,
|
||||
Back = 6,
|
||||
Start = 7,
|
||||
LeftStickButton = 8,
|
||||
RightStickButton = 9,
|
||||
|
||||
@@ -25,10 +25,19 @@ local joystickHelper = asset.require("./joystick_helper")
|
||||
-- Eighth parameter is the sensitivity for the axis
|
||||
|
||||
local PS4Controller = {
|
||||
LeftThumbStick = { 0 , 1 },
|
||||
RightThumbStick = { 2, 5 },
|
||||
-- Axes
|
||||
LeftThumbStick = {
|
||||
LeftRight = 0,
|
||||
UpDown = 1
|
||||
},
|
||||
RightThumbStick = {
|
||||
LeftRight = 2,
|
||||
UpDown = 5
|
||||
},
|
||||
L2 = 3,
|
||||
R2 = 4,
|
||||
|
||||
-- Buttons
|
||||
Cross = 1,
|
||||
Circle = 2,
|
||||
Square = 0,
|
||||
@@ -56,17 +65,17 @@ asset.onInitialize(function()
|
||||
|
||||
local deadzoneJoysticks = 0.2
|
||||
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.LeftThumbStick.LeftRight, deadzoneJoysticks)
|
||||
openspace.navigation.setAxisDeadZone(name, controller.LeftThumbStick.UpDown, deadzoneJoysticks)
|
||||
openspace.navigation.setAxisDeadZone(name, controller.RightThumbStick.LeftRight, deadzoneJoysticks)
|
||||
openspace.navigation.setAxisDeadZone(name, controller.RightThumbStick.UpDown, 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")
|
||||
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.LeftThumbStick.LeftRight, "Orbit X")
|
||||
openspace.navigation.bindJoystickAxis(name, controller.LeftThumbStick.UpDown, "Orbit Y")
|
||||
openspace.navigation.bindJoystickAxis(name, controller.RightThumbStick.LeftRight, "Pan X", true)
|
||||
openspace.navigation.bindJoystickAxis(name, controller.RightThumbStick.UpDown, "Pan Y", true)
|
||||
openspace.navigation.bindJoystickAxis(name, controller.L2, "Zoom Out", false, "TriggerLike")
|
||||
openspace.navigation.bindJoystickAxis(name, controller.R2, "Zoom In", false, "TriggerLike")
|
||||
|
||||
@@ -74,15 +83,15 @@ asset.onInitialize(function()
|
||||
openspace.navigation.bindJoystickButton(
|
||||
name,
|
||||
controller.DPad.Up,
|
||||
joystickHelper.bindLocalRoll(name, controller.RightThumbStick[1]) ..
|
||||
"openspace.navigation.bindJoystickAxis('" .. name .. "', " .. controller.RightThumbStick[2] .. ", 'None')",
|
||||
joystickHelper.bindLocalRoll(name, controller.RightThumbStick.LeftRight) ..
|
||||
"openspace.navigation.bindJoystickAxis('" .. name .. "', " .. controller.RightThumbStick.UpDown .. ", 'None')",
|
||||
"Switch to roll mode"
|
||||
)
|
||||
openspace.navigation.bindJoystickButton(
|
||||
name,
|
||||
controller.DPad.Up,
|
||||
joystickHelper.unbindRoll(name, controller.RightThumbStick[1]) ..
|
||||
"openspace.navigation.bindJoystickAxis('" .. name .. "', " .. controller.RightThumbStick[2] .. ", 'Pan Y', true)",
|
||||
joystickHelper.unbindRoll(name, controller.RightThumbStick.LeftRight) ..
|
||||
"openspace.navigation.bindJoystickAxis('" .. name .. "', " .. controller.RightThumbStick.UpDown .. ", 'Pan Y', true)",
|
||||
"Switch back to normal mode",
|
||||
"Release"
|
||||
)
|
||||
|
||||
@@ -26,10 +26,19 @@ local joystickHelper = asset.require("./joystick_helper")
|
||||
-- Eighth 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
|
||||
-- Axes
|
||||
Push = {
|
||||
LeftRight = 0,
|
||||
BackForth = 1,
|
||||
UpDown = 2
|
||||
},
|
||||
Twist = 5,
|
||||
Tilt = {
|
||||
LeftRight = 4,
|
||||
BackForth = 3
|
||||
},
|
||||
|
||||
-- Buttons
|
||||
LeftButton = 0,
|
||||
RightButton = 1
|
||||
}
|
||||
@@ -39,24 +48,24 @@ asset.onInitialize(function()
|
||||
local controller = SpaceMouse
|
||||
local name = "3Dconnexion Universal Receiver"
|
||||
|
||||
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", false, "JoystickLike", true, false, 35.0)
|
||||
openspace.navigation.bindJoystickAxis(name, controller.Push.LeftRight, "Orbit X", false, "JoystickLike", true, false, 40.0)
|
||||
openspace.navigation.bindJoystickAxis(name, controller.Push.BackForth, "Orbit Y", false, "JoystickLike", true, false, 40.0)
|
||||
openspace.navigation.bindJoystickAxis(name, controller.Twist, "Pan X", true, "JoystickLike", true, false, 40.0)
|
||||
openspace.navigation.bindJoystickAxis(name, controller.Tilt.BackForth, "Pan Y", false, "JoystickLike", true, false, 35.0)
|
||||
openspace.navigation.bindJoystickAxis(name, controller.Push.UpDown, "Zoom", false, "JoystickLike", true, false, 40.0)
|
||||
openspace.navigation.bindJoystickAxis(name, controller.Tilt.LeftRight, "LocalRoll", false, "JoystickLike", true, false, 35.0)
|
||||
|
||||
openspace.navigation.bindJoystickButton(
|
||||
name,
|
||||
controller.LeftButton,
|
||||
joystickHelper.permaBindLocalRoll(name, controller.Tilt[1]),
|
||||
joystickHelper.permaBindLocalRoll(name, controller.Tilt.LeftRight),
|
||||
"Switch to local roll mode"
|
||||
)
|
||||
|
||||
openspace.navigation.bindJoystickButton(
|
||||
name,
|
||||
controller.RightButton,
|
||||
joystickHelper.permaBindGlobalRoll(name, controller.Tilt[1]),
|
||||
joystickHelper.permaBindGlobalRoll(name, controller.Tilt.LeftRight),
|
||||
"Switch to global roll mode"
|
||||
)
|
||||
end)
|
||||
|
||||
@@ -26,10 +26,19 @@ local joystickHelper = asset.require("./joystick_helper")
|
||||
-- Eighth 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
|
||||
-- Axes
|
||||
Push = {
|
||||
LeftRight = 0,
|
||||
BackForth = 1,
|
||||
UpDown = 2
|
||||
},
|
||||
Twist = 5,
|
||||
Tilt = {
|
||||
LeftRight = 4,
|
||||
BackForth = 3
|
||||
},
|
||||
|
||||
-- Buttons
|
||||
LeftButton = 0,
|
||||
RightButton = 1
|
||||
}
|
||||
@@ -39,24 +48,24 @@ asset.onInitialize(function()
|
||||
local controller = SpaceMouse
|
||||
local name = "SpaceNavigator"
|
||||
|
||||
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", false, "JoystickLike", true, false, 35.0)
|
||||
openspace.navigation.bindJoystickAxis(name, controller.Push.LeftRight, "Orbit X", false, "JoystickLike", true, false, 40.0)
|
||||
openspace.navigation.bindJoystickAxis(name, controller.Push.BackForth, "Orbit Y", false, "JoystickLike", true, false, 40.0)
|
||||
openspace.navigation.bindJoystickAxis(name, controller.Twist, "Pan X", true, "JoystickLike", true, false, 40.0)
|
||||
openspace.navigation.bindJoystickAxis(name, controller.Tilt.BackForth, "Pan Y", false, "JoystickLike", true, false, 35.0)
|
||||
openspace.navigation.bindJoystickAxis(name, controller.Push.UpDown, "Zoom", false, "JoystickLike", true, false, 40.0)
|
||||
openspace.navigation.bindJoystickAxis(name, controller.Tilt.LeftRight, "LocalRoll", false, "JoystickLike", true, false, 35.0)
|
||||
|
||||
openspace.navigation.bindJoystickButton(
|
||||
name,
|
||||
controller.LeftButton,
|
||||
joystickHelper.permaBindLocalRoll(name, controller.Tilt[1]),
|
||||
joystickHelper.permaBindLocalRoll(name, controller.Tilt.LeftRight),
|
||||
"Switch to local roll mode"
|
||||
)
|
||||
|
||||
openspace.navigation.bindJoystickButton(
|
||||
name,
|
||||
controller.RightButton,
|
||||
joystickHelper.permaBindGlobalRoll(name, controller.Tilt[1]),
|
||||
joystickHelper.permaBindGlobalRoll(name, controller.Tilt.LeftRight),
|
||||
"Switch to global roll mode"
|
||||
)
|
||||
end)
|
||||
|
||||
@@ -26,12 +26,21 @@ local joystickHelper = asset.require("./joystick_helper")
|
||||
-- Eighth 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
|
||||
-- Axes
|
||||
Push = {
|
||||
LeftRight = 0,
|
||||
BackForth = 1,
|
||||
UpDown = 2
|
||||
},
|
||||
Twist = 5,
|
||||
Tilt = {
|
||||
LeftRight = 4,
|
||||
BackForth = 3
|
||||
},
|
||||
|
||||
-- Buttons on the Enterprise version of the SpaceMouse is not detectable, use regular
|
||||
-- keybindings instead, for more information see our wiki page.
|
||||
-- keybindings instead, for more information see our wiki page
|
||||
-- http://wiki.openspaceproject.com/docs/users/navigation/joysticks.html.
|
||||
}
|
||||
|
||||
|
||||
@@ -40,17 +49,17 @@ asset.onInitialize(function()
|
||||
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.setAxisDeadZone(name, controller.Push.LeftRight, deadzone)
|
||||
openspace.navigation.setAxisDeadZone(name, controller.Push.BackForth, deadzone)
|
||||
openspace.navigation.setAxisDeadZone(name, controller.Twist, deadzone)
|
||||
openspace.navigation.setAxisDeadZone(name, controller.Tilt.BackForth, deadzone)
|
||||
openspace.navigation.setAxisDeadZone(name, controller.Push.UpDown, deadzone)
|
||||
openspace.navigation.setAxisDeadZone(name, controller.Tilt.LeftRight, 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")
|
||||
openspace.navigation.bindJoystickAxis(name, controller.Push.LeftRight, "Orbit X")
|
||||
openspace.navigation.bindJoystickAxis(name, controller.Push.BackForth, "Orbit Y")
|
||||
openspace.navigation.bindJoystickAxis(name, controller.Twist, "Pan X", true)
|
||||
openspace.navigation.bindJoystickAxis(name, controller.Tilt.BackForth, "Pan Y")
|
||||
openspace.navigation.bindJoystickAxis(name, controller.Push.UpDown, "Zoom")
|
||||
openspace.navigation.bindJoystickAxis(name, controller.Tilt.LeftRight, "LocalRoll")
|
||||
end)
|
||||
|
||||
@@ -26,12 +26,21 @@ local joystickHelper = asset.require("./joystick_helper")
|
||||
-- Eighth 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
|
||||
-- Axes
|
||||
Push = {
|
||||
LeftRight = 0,
|
||||
BackForth = 1,
|
||||
UpDown = 2
|
||||
},
|
||||
Twist = 5,
|
||||
Tilt = {
|
||||
LeftRight = 4,
|
||||
BackForth = 3
|
||||
}
|
||||
|
||||
-- Buttons on the Enterprise version of the SpaceMouse is not detectable, use regular
|
||||
-- keybindings instead, for more information see our wiki page.
|
||||
-- keybindings instead, for more information see our wiki page
|
||||
-- http://wiki.openspaceproject.com/docs/users/navigation/joysticks.html.
|
||||
}
|
||||
|
||||
|
||||
@@ -40,17 +49,17 @@ asset.onInitialize(function()
|
||||
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.setAxisDeadZone(name, controller.Push.LeftRight, deadzone)
|
||||
openspace.navigation.setAxisDeadZone(name, controller.Push.BackForth, deadzone)
|
||||
openspace.navigation.setAxisDeadZone(name, controller.Twist, deadzone)
|
||||
openspace.navigation.setAxisDeadZone(name, controller.Tilt.BackForth, deadzone)
|
||||
openspace.navigation.setAxisDeadZone(name, controller.Push.UpDown, deadzone)
|
||||
openspace.navigation.setAxisDeadZone(name, controller.Tilt.LeftRight, 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")
|
||||
openspace.navigation.bindJoystickAxis(name, controller.Push.LeftRight, "Orbit X")
|
||||
openspace.navigation.bindJoystickAxis(name, controller.Push.BackForth, "Orbit Y")
|
||||
openspace.navigation.bindJoystickAxis(name, controller.Twist, "Pan X", true)
|
||||
openspace.navigation.bindJoystickAxis(name, controller.Tilt.BackForth, "Pan Y")
|
||||
openspace.navigation.bindJoystickAxis(name, controller.Push.UpDown, "Zoom")
|
||||
openspace.navigation.bindJoystickAxis(name, controller.Tilt.LeftRight, "LocalRoll")
|
||||
end)
|
||||
|
||||
@@ -25,10 +25,19 @@ local joystickHelper = asset.require("./joystick_helper")
|
||||
-- Eighth parameter is the sensitivity for the axis
|
||||
|
||||
local XBoxController = {
|
||||
LeftThumbStick = { 0 , 1 },
|
||||
RightThumbStick = { 2, 3 },
|
||||
-- Axes
|
||||
LeftThumbStick = {
|
||||
LeftRight = 0,
|
||||
UpDown = 1
|
||||
},
|
||||
RightThumbStick = {
|
||||
LeftRight = 2,
|
||||
UpDown = 3
|
||||
},
|
||||
LeftTrigger = 4,
|
||||
RightTrigger = 5,
|
||||
|
||||
-- Buttons
|
||||
A = 0,
|
||||
B = 1,
|
||||
X = 2,
|
||||
@@ -54,17 +63,17 @@ asset.onInitialize(function()
|
||||
|
||||
local deadzoneJoysticks = 0.2
|
||||
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.LeftThumbStick.LeftRight, deadzoneJoysticks)
|
||||
openspace.navigation.setAxisDeadZone(name, controller.LeftThumbStick.UpDown, deadzoneJoysticks)
|
||||
openspace.navigation.setAxisDeadZone(name, controller.RightThumbStick.LeftRight, deadzoneJoysticks)
|
||||
openspace.navigation.setAxisDeadZone(name, controller.RightThumbStick.UpDown, 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")
|
||||
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.LeftThumbStick.LeftRight, "Orbit X")
|
||||
openspace.navigation.bindJoystickAxis(name, controller.LeftThumbStick.UpDown, "Orbit Y")
|
||||
openspace.navigation.bindJoystickAxis(name, controller.RightThumbStick.LeftRight, "Pan X", true)
|
||||
openspace.navigation.bindJoystickAxis(name, controller.RightThumbStick.UpDown, "Pan Y", true)
|
||||
openspace.navigation.bindJoystickAxis(name, controller.LeftTrigger, "Zoom Out", false, "TriggerLike")
|
||||
openspace.navigation.bindJoystickAxis(name, controller.RightTrigger, "Zoom In", false, "TriggerLike")
|
||||
|
||||
@@ -72,15 +81,15 @@ asset.onInitialize(function()
|
||||
openspace.navigation.bindJoystickButton(
|
||||
name,
|
||||
controller.DPad.Up,
|
||||
joystickHelper.bindLocalRoll(name, controller.RightThumbStick[1]) ..
|
||||
"openspace.navigation.bindJoystickAxis('" .. name .. "', " .. controller.RightThumbStick[2] .. ", 'None')",
|
||||
joystickHelper.bindLocalRoll(name, controller.RightThumbStick.LeftRight) ..
|
||||
"openspace.navigation.bindJoystickAxis('" .. name .. "', " .. controller.RightThumbStick.UpDown .. ", 'None')",
|
||||
"Switch to roll mode"
|
||||
)
|
||||
openspace.navigation.bindJoystickButton(
|
||||
name,
|
||||
controller.DPad.Up,
|
||||
joystickHelper.unbindRoll(name, controller.RightThumbStick[1]) ..
|
||||
"openspace.navigation.bindJoystickAxis('" .. name .. "', " .. controller.RightThumbStick[2] .. ", 'Pan Y', true)",
|
||||
joystickHelper.unbindRoll(name, controller.RightThumbStick.LeftRight) ..
|
||||
"openspace.navigation.bindJoystickAxis('" .. name .. "', " .. controller.RightThumbStick.UpDown .. ", 'Pan Y', true)",
|
||||
"Switch back to normal mode",
|
||||
"Release"
|
||||
)
|
||||
|
||||
@@ -25,10 +25,19 @@ local joystickHelper = asset.require("./joystick_helper")
|
||||
-- Eighth parameter is the sensitivity for the axis
|
||||
|
||||
local XBoxController = {
|
||||
LeftThumbStick = { 0 , 1 },
|
||||
RightThumbStick = { 2, 3 },
|
||||
-- Axes
|
||||
LeftThumbStick = {
|
||||
LeftRight = 0,
|
||||
UpDown = 1
|
||||
},
|
||||
RightThumbStick = {
|
||||
LeftRight = 2,
|
||||
UpDown = 3
|
||||
},
|
||||
LeftTrigger = 4,
|
||||
RightTrigger = 5,
|
||||
|
||||
-- Buttons
|
||||
A = 0,
|
||||
B = 1,
|
||||
X = 2,
|
||||
@@ -54,17 +63,17 @@ asset.onInitialize(function()
|
||||
|
||||
local deadzoneJoysticks = 0.2
|
||||
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.LeftThumbStick.LeftRight, deadzoneJoysticks)
|
||||
openspace.navigation.setAxisDeadZone(name, controller.LeftThumbStick.UpDown, deadzoneJoysticks)
|
||||
openspace.navigation.setAxisDeadZone(name, controller.RightThumbStick.LeftRight, deadzoneJoysticks)
|
||||
openspace.navigation.setAxisDeadZone(name, controller.RightThumbStick.UpDown, 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")
|
||||
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.LeftThumbStick.LeftRight, "Orbit X")
|
||||
openspace.navigation.bindJoystickAxis(name, controller.LeftThumbStick.UpDown, "Orbit Y")
|
||||
openspace.navigation.bindJoystickAxis(name, controller.RightThumbStick.LeftRight, "Pan X", true)
|
||||
openspace.navigation.bindJoystickAxis(name, controller.RightThumbStick.UpDown, "Pan Y", true)
|
||||
openspace.navigation.bindJoystickAxis(name, controller.LeftTrigger, "Zoom Out", false, "TriggerLike")
|
||||
openspace.navigation.bindJoystickAxis(name, controller.RightTrigger, "Zoom In", false, "TriggerLike")
|
||||
|
||||
@@ -72,15 +81,15 @@ asset.onInitialize(function()
|
||||
openspace.navigation.bindJoystickButton(
|
||||
name,
|
||||
controller.DPad.Up,
|
||||
joystickHelper.bindLocalRoll(name, controller.RightThumbStick[1]) ..
|
||||
"openspace.navigation.bindJoystickAxis('" .. name .. "', " .. controller.RightThumbStick[2] .. ", 'None')",
|
||||
joystickHelper.bindLocalRoll(name, controller.RightThumbStick.LeftRight) ..
|
||||
"openspace.navigation.bindJoystickAxis('" .. name .. "', " .. controller.RightThumbStick.UpDown .. ", 'None')",
|
||||
"Switch to roll mode"
|
||||
)
|
||||
openspace.navigation.bindJoystickButton(
|
||||
name,
|
||||
controller.DPad.Up,
|
||||
joystickHelper.unbindRoll(name, controller.RightThumbStick[1]) ..
|
||||
"openspace.navigation.bindJoystickAxis('" .. name .. "', " .. controller.RightThumbStick[2] .. ", 'Pan Y', true)",
|
||||
joystickHelper.unbindRoll(name, controller.RightThumbStick.LeftRight) ..
|
||||
"openspace.navigation.bindJoystickAxis('" .. name .. "', " .. controller.RightThumbStick.UpDown .. ", 'Pan Y', true)",
|
||||
"Switch back to normal mode",
|
||||
"Release"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user