Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
feat(input): add hotbar bindings (#21)
  • Loading branch information
Xenira committed Dec 16, 2023
1 parent 7926cd3 commit e4c472a
Show file tree
Hide file tree
Showing 11 changed files with 283 additions and 26 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
@@ -1,7 +1,7 @@
---
name: Bug report
about: Create a report to help us improve
title: "[BUG}"
title: "[BUG]"
labels: bug
assignees: Xenira

Expand Down
22 changes: 10 additions & 12 deletions README.adoc
Expand Up @@ -9,7 +9,7 @@ v.0.1.0

This is a mod for the game https://store.steampowered.com/app/1457320/Techtonica/[Techtonica] that adds VR support.

CAUTION: This mod is still in early development and *will* contain bugs. Use at your own risk. Only tested with the Valve Index and Knuckles controllers.
CAUTION: This mod is still in early development and *will* contain bugs. Use at your own risk. Only tested with the Valve Index / Pimax Crystal and Knuckles controllers.

== Prerequisites

Expand Down Expand Up @@ -54,25 +54,23 @@ While the mod is in a playable state, it is still in early development. Some fea
=== Missing
- Gesture support (e.g. Mining using pickaxe motion)
- Comfort options (e.g. Teleportation). Smooth locomotion and turning only for now.
- Comfort options (e.g. Teleportation). Smooth locomotion and turning only for now. (#9)
- Model for the player's body. Currently not a priority as this requires IK.
- Default bindings for VR controllers other than the Valve Index Controllers
- Default bindings for VR controllers other than the Valve Index Controllers (#16, #17)
- Object outlines. Disabled for now as the shader is broken in VR.
- Finger tracking
- Finger tracking (#15)
- Ability to switch primary hand
- Ability to yeet paladin down the waterfall
- Hand crank using uhhhhh... hands?
- Hotbar reassignment
- Machine info not visible when targeting with hand. (#12)
- Crafting queue not visible. (#11)
=== Known Issues
- The players position is not synced correctly with the game when using roomscale. The characters position is in the center of the playspace. This might cause issues with collisions and other things. Also map shows the player looking in the wrong direction.
- Button prompts are not for VR controllers.
- The players position is not synced correctly with the game when using roomscale. The characters position is in the center of the playspace. This might cause issues with collisions and other things. Also map shows the player looking in the wrong direction. (#14)
- Button prompts are not for VR controllers. (#13)
- Haptics are played on both controllers by the game. One improvement would be to play them on the hand that is actually holding the tool.
- Use and interact buttons are mapped to the same button. This might cause issues when interacting with objects.
- Machine info not visible when targeting with hand.
- Crafting queue not visible.
- The game is locked to 60fps when running in windowed mode. This is based on the refresh rate of your monitor. To unlock the framerate, switch to fullscreen mode. (For now)
- Menus are a little jittery
- The game is locked to 60fps when running in windowed mode. This is based on the refresh rate of your monitor. To unlock the framerate, switch to fullscreen mode. (#10)
- Menus are a little jittery (#18)
=== Cool stuff to try
- Tobii eye tracking for dynamic foveated rendering
Expand Down
Binary file modified libs/Managed/SteamVR_Actions.dll
Binary file not shown.
27 changes: 26 additions & 1 deletion libs/StreamingAssets/SteamVR/actions.json
Expand Up @@ -173,6 +173,26 @@
"name": "/actions/default/in/UIShortcut1",
"type": "boolean"
},
{
"name": "/actions/default/in/ToggleHotbarEdit",
"type": "boolean"
},
{
"name": "/actions/default/in/ExitHotbarEdit",
"type": "boolean"
},
{
"name": "/actions/default/in/PauseMenu",
"type": "boolean"
},
{
"name": "/actions/default/in/ClearHotbar",
"type": "boolean"
},
{
"name": "/actions/default/in/HotbarSwap",
"type": "boolean"
},
{
"name": "/actions/default/out/Haptic",
"type": "vibration"
Expand Down Expand Up @@ -281,7 +301,12 @@
"/actions/default/in/ToggleErase": "Toggle Erase",
"/actions/default/in/Use": "Use",
"/actions/default/in/UIShortcut2": "<Unused>",
"/actions/default/in/UIShortcut1": "Crank"
"/actions/default/in/UIShortcut1": "Crank",
"/actions/default/in/ToggleHotbarEdit": "Toggle Hotbar Edit",
"/actions/default/in/ExitHotbarEdit": "Exit Hotbar Edit",
"/actions/default/in/PauseMenu": "Toggle Pause Menu",
"/actions/default/in/ClearHotbar": "Clear Hotbar",
"/actions/default/in/HotbarSwap": "Swap Hotbar Item"
}
]
}
47 changes: 43 additions & 4 deletions libs/StreamingAssets/SteamVR/bindings_knuckles.json
@@ -1,7 +1,7 @@
{
"action_manifest_version" : 0,
"alias_info" : {},
"app_key" : "system.generated.unity.exe",
"app_key" : "application.generated.unity.unity.exe",
"bindings" : {
"/actions/buggy" : {
"chords" : [],
Expand Down Expand Up @@ -125,9 +125,6 @@
},
{
"inputs" : {
"click" : {
"output" : "/actions/default/in/sprint"
},
"position" : {
"output" : "/actions/default/in/smoothturn"
}
Expand All @@ -137,6 +134,9 @@
},
{
"inputs" : {
"click" : {
"output" : "/actions/default/in/sprint"
},
"position" : {
"output" : "/actions/default/in/move"
}
Expand Down Expand Up @@ -272,6 +272,9 @@
},
{
"inputs" : {
"click" : {
"output" : "/actions/default/in/togglehotbaredit"
},
"position" : {
"output" : "/actions/default/in/menujoysticksecondary"
}
Expand Down Expand Up @@ -320,6 +323,42 @@
"sub_mode" : "click"
},
"path" : "/user/hand/left/input/trackpad"
},
{
"inputs" : {
"click" : {
"output" : "/actions/default/in/exithotbaredit"
}
},
"mode" : "button",
"path" : "/user/hand/right/input/b"
},
{
"inputs" : {
"click" : {
"output" : "/actions/default/in/pausemenu"
}
},
"mode" : "button",
"path" : "/user/hand/right/input/system"
},
{
"inputs" : {
"click" : {
"output" : "/actions/default/in/clearhotbar"
}
},
"mode" : "button",
"path" : "/user/hand/left/input/b"
},
{
"inputs" : {
"click" : {
"output" : "/actions/default/in/hotbarswap"
}
},
"mode" : "button",
"path" : "/user/hand/right/input/a"
}
]
},
Expand Down
11 changes: 11 additions & 0 deletions plugin/src/input/input_patches.cs
Expand Up @@ -289,6 +289,15 @@ private static Button MapButtonState(int actionId)
return SteamVRInputMapper.UISubmit;
case RewiredConsts.Action.UI_Cancel:
return SteamVRInputMapper.UICancel;
case RewiredConsts.Action.Hotbar_Edit_Single:
return SteamVRInputMapper.HotbarEdit;
case RewiredConsts.Action.Lock_Toolbar:
case RewiredConsts.Action.Edit_Shotcut:
return SteamVRInputMapper.HotbarSwapItem;
case RewiredConsts.Action.Exit_Hotbar:
return SteamVRInputMapper.HotbarExitEdit;
case RewiredConsts.Action.Clear_Shortcut:
return SteamVRInputMapper.HotbarClear;
case RewiredConsts.Action.UI_Shortcut_1:
return SteamVRInputMapper.UIShortcut1;
case RewiredConsts.Action.UI_Shortcut_2:
Expand All @@ -311,6 +320,8 @@ private static Button MapButtonState(int actionId)
return SteamVRInputMapper.cycleHotbarRight;
case RewiredConsts.Action.KB_TechTree:
return SteamVRInputMapper.TechTree;
case RewiredConsts.Action.Pause:
return SteamVRInputMapper.PauseMenu;
default:
// Plugin.Logger.LogDebug($"Unknown Rewired button action ID: {actionId}. Using default Rewired input.");
return null;
Expand Down
5 changes: 5 additions & 0 deletions plugin/src/input/steamvr_input_mapper.cs
Expand Up @@ -40,8 +40,13 @@ public static class SteamVRInputMapper
public static Button UIPageRightSecondary = new Button(SteamVR_Actions._default.UIPageRightSecondary);
public static Button UISubmit = new Button(SteamVR_Actions._default.UISubmit);
public static Button UICancel = new Button(SteamVR_Actions._default.UICancel);
public static Button HotbarEdit = new Button(SteamVR_Actions._default.ToggleHotbarEdit);
public static Button HotbarSwapItem = new Button(SteamVR_Actions._default.HotbarSwap);
public static Button HotbarExitEdit = new Button(SteamVR_Actions._default.ExitHotbarEdit);
public static Button HotbarClear = new Button(SteamVR_Actions._default.ClearHotbar);
public static Button UIShortcut1 = new Button(SteamVR_Actions._default.UIShortcut1);
public static Button UIShortcut2 = new Button(SteamVR_Actions._default.UIShortcut2);
public static Button PauseMenu = new Button(SteamVR_Actions._default.PauseMenu);

public static Button cycleHotbarLeft = new Button(SteamVR_Actions._default.CycleHotbarLeft);
public static Button cycleHotbarRight = new Button(SteamVR_Actions._default.CycleHotbarRight);
Expand Down
Expand Up @@ -345,6 +345,46 @@ public virtual SteamVR_Action_Boolean UIShortcut1
}
}

public virtual SteamVR_Action_Boolean ToggleHotbarEdit
{
get
{
return SteamVR_Actions.default_ToggleHotbarEdit;
}
}

public virtual SteamVR_Action_Boolean ExitHotbarEdit
{
get
{
return SteamVR_Actions.default_ExitHotbarEdit;
}
}

public virtual SteamVR_Action_Boolean PauseMenu
{
get
{
return SteamVR_Actions.default_PauseMenu;
}
}

public virtual SteamVR_Action_Boolean ClearHotbar
{
get
{
return SteamVR_Actions.default_ClearHotbar;
}
}

public virtual SteamVR_Action_Boolean HotbarSwap
{
get
{
return SteamVR_Actions.default_HotbarSwap;
}
}

public virtual SteamVR_Action_Vibration Haptic
{
get
Expand Down
81 changes: 78 additions & 3 deletions unity/Assets/SteamVR_Input/SteamVR_Input_Actions.cs
Expand Up @@ -99,6 +99,16 @@ public partial class SteamVR_Actions

private static SteamVR_Action_Boolean p_default_UIShortcut1;

private static SteamVR_Action_Boolean p_default_ToggleHotbarEdit;

private static SteamVR_Action_Boolean p_default_ExitHotbarEdit;

private static SteamVR_Action_Boolean p_default_PauseMenu;

private static SteamVR_Action_Boolean p_default_ClearHotbar;

private static SteamVR_Action_Boolean p_default_HotbarSwap;

private static SteamVR_Action_Vibration p_default_Haptic;

public static SteamVR_Action_Boolean default_GrabPinch
Expand Down Expand Up @@ -429,6 +439,46 @@ public static SteamVR_Action_Boolean default_UIShortcut1
}
}

public static SteamVR_Action_Boolean default_ToggleHotbarEdit
{
get
{
return SteamVR_Actions.p_default_ToggleHotbarEdit.GetCopy<SteamVR_Action_Boolean>();
}
}

public static SteamVR_Action_Boolean default_ExitHotbarEdit
{
get
{
return SteamVR_Actions.p_default_ExitHotbarEdit.GetCopy<SteamVR_Action_Boolean>();
}
}

public static SteamVR_Action_Boolean default_PauseMenu
{
get
{
return SteamVR_Actions.p_default_PauseMenu.GetCopy<SteamVR_Action_Boolean>();
}
}

public static SteamVR_Action_Boolean default_ClearHotbar
{
get
{
return SteamVR_Actions.p_default_ClearHotbar.GetCopy<SteamVR_Action_Boolean>();
}
}

public static SteamVR_Action_Boolean default_HotbarSwap
{
get
{
return SteamVR_Actions.p_default_HotbarSwap.GetCopy<SteamVR_Action_Boolean>();
}
}

public static SteamVR_Action_Vibration default_Haptic
{
get
Expand Down Expand Up @@ -481,6 +531,11 @@ private static void InitializeActionArrays()
SteamVR_Actions.default_Use,
SteamVR_Actions.default_UIShortcut2,
SteamVR_Actions.default_UIShortcut1,
SteamVR_Actions.default_ToggleHotbarEdit,
SteamVR_Actions.default_ExitHotbarEdit,
SteamVR_Actions.default_PauseMenu,
SteamVR_Actions.default_ClearHotbar,
SteamVR_Actions.default_HotbarSwap,
SteamVR_Actions.default_Haptic};
Valve.VR.SteamVR_Input.actionsIn = new Valve.VR.ISteamVR_Action_In[] {
SteamVR_Actions.default_GrabPinch,
Expand Down Expand Up @@ -523,7 +578,12 @@ private static void InitializeActionArrays()
SteamVR_Actions.default_ToggleErase,
SteamVR_Actions.default_Use,
SteamVR_Actions.default_UIShortcut2,
SteamVR_Actions.default_UIShortcut1};
SteamVR_Actions.default_UIShortcut1,
SteamVR_Actions.default_ToggleHotbarEdit,
SteamVR_Actions.default_ExitHotbarEdit,
SteamVR_Actions.default_PauseMenu,
SteamVR_Actions.default_ClearHotbar,
SteamVR_Actions.default_HotbarSwap};
Valve.VR.SteamVR_Input.actionsOut = new Valve.VR.ISteamVR_Action_Out[] {
SteamVR_Actions.default_Haptic};
Valve.VR.SteamVR_Input.actionsVibration = new Valve.VR.SteamVR_Action_Vibration[] {
Expand Down Expand Up @@ -563,7 +623,12 @@ private static void InitializeActionArrays()
SteamVR_Actions.default_ToggleErase,
SteamVR_Actions.default_Use,
SteamVR_Actions.default_UIShortcut2,
SteamVR_Actions.default_UIShortcut1};
SteamVR_Actions.default_UIShortcut1,
SteamVR_Actions.default_ToggleHotbarEdit,
SteamVR_Actions.default_ExitHotbarEdit,
SteamVR_Actions.default_PauseMenu,
SteamVR_Actions.default_ClearHotbar,
SteamVR_Actions.default_HotbarSwap};
Valve.VR.SteamVR_Input.actionsSingle = new Valve.VR.SteamVR_Action_Single[] {
SteamVR_Actions.default_Squeeze};
Valve.VR.SteamVR_Input.actionsVector2 = new Valve.VR.SteamVR_Action_Vector2[] {
Expand Down Expand Up @@ -612,7 +677,12 @@ private static void InitializeActionArrays()
SteamVR_Actions.default_ToggleErase,
SteamVR_Actions.default_Use,
SteamVR_Actions.default_UIShortcut2,
SteamVR_Actions.default_UIShortcut1};
SteamVR_Actions.default_UIShortcut1,
SteamVR_Actions.default_ToggleHotbarEdit,
SteamVR_Actions.default_ExitHotbarEdit,
SteamVR_Actions.default_PauseMenu,
SteamVR_Actions.default_ClearHotbar,
SteamVR_Actions.default_HotbarSwap};
}

private static void PreInitActions()
Expand Down Expand Up @@ -658,6 +728,11 @@ private static void PreInitActions()
SteamVR_Actions.p_default_Use = ((SteamVR_Action_Boolean)(SteamVR_Action.Create<SteamVR_Action_Boolean>("/actions/default/in/Use")));
SteamVR_Actions.p_default_UIShortcut2 = ((SteamVR_Action_Boolean)(SteamVR_Action.Create<SteamVR_Action_Boolean>("/actions/default/in/UIShortcut2")));
SteamVR_Actions.p_default_UIShortcut1 = ((SteamVR_Action_Boolean)(SteamVR_Action.Create<SteamVR_Action_Boolean>("/actions/default/in/UIShortcut1")));
SteamVR_Actions.p_default_ToggleHotbarEdit = ((SteamVR_Action_Boolean)(SteamVR_Action.Create<SteamVR_Action_Boolean>("/actions/default/in/ToggleHotbarEdit")));
SteamVR_Actions.p_default_ExitHotbarEdit = ((SteamVR_Action_Boolean)(SteamVR_Action.Create<SteamVR_Action_Boolean>("/actions/default/in/ExitHotbarEdit")));
SteamVR_Actions.p_default_PauseMenu = ((SteamVR_Action_Boolean)(SteamVR_Action.Create<SteamVR_Action_Boolean>("/actions/default/in/PauseMenu")));
SteamVR_Actions.p_default_ClearHotbar = ((SteamVR_Action_Boolean)(SteamVR_Action.Create<SteamVR_Action_Boolean>("/actions/default/in/ClearHotbar")));
SteamVR_Actions.p_default_HotbarSwap = ((SteamVR_Action_Boolean)(SteamVR_Action.Create<SteamVR_Action_Boolean>("/actions/default/in/HotbarSwap")));
SteamVR_Actions.p_default_Haptic = ((SteamVR_Action_Vibration)(SteamVR_Action.Create<SteamVR_Action_Vibration>("/actions/default/out/Haptic")));
}
}
Expand Down

0 comments on commit e4c472a

Please sign in to comment.