Skip to content

Commit

Permalink
feat(input): add smooth turning
Browse files Browse the repository at this point in the history
  • Loading branch information
Xenira committed Dec 3, 2023
1 parent 9d0827a commit dd579c9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 122 deletions.
14 changes: 0 additions & 14 deletions plugin/src/camera/patches/arms_spring_patch.cs

This file was deleted.

111 changes: 3 additions & 108 deletions plugin/src/input/input_patches.cs
Original file line number Diff line number Diff line change
@@ -1,117 +1,12 @@
using System.Linq;
using HarmonyLib;
using Plugin.Input;
using TechtonicaVR.VRCamera;
using UnityEngine;
using Valve.VR;

namespace TechtonicaVR.Input;

// Action: Move Horizontal (0)
// Action: Move Vertical (1)
// Action: Look Horizontal (2)
// Action: Look Vertical (3)
// Action: Jump (4)
// Action: Interact (5)
// Action: Pause (9)
// Action: Sprint (16)
// Action: Rotate Left (19)
// Action: Rotate Clockwise (38)
// Action: Rotate Counterclockwise (42)
// Action: Toggle Erase (43)
// Action: Crafting Menu (45)
// Action: Erase (46)
// Action: Cycle Hotbar Left (52)
// Action: Cycle Hotbar Right (97)
// Action: Cycle Toolbar Up (71)
// Action: Cycle Toolbar Down (98)
// Action: UI Horizontal Secondary (57)
// Action: UI Horizontal Primary (61)
// Action: UI Vertical Secondary (58)
// Action: UI Vertical Primary (62)
// Action: UI Submit (59)
// Action: UI Cancel (60)
// Action: KB CancelMenu (134)
// Action: KB PowerMenu (135)
// Action: KB TechTree (136)
// Action: UI Shortcut 1 (63)
// Action: UI Shortcut 2 (64)
// Action: UIPageLeft (65)
// Action: UIPageRight (66)
// Action: UI Shortcut 3 (67)
// Action: Use (69)
// Action: Put Away (70)
// Action: Hotbar 0 (72)
// Action: Hotbar 9 (81)
// Action: Hotbar 8 (80)
// Action: Hotbar 7 (79)
// Action: Hotbar 6 (78)
// Action: Hotbar 5 (77)
// Action: Hotbar 4 (76)
// Action: Hotbar 3 (75)
// Action: Hotbar 2 (74)
// Action: Hotbar 1 (73)
// Action: Third Person View (82)
// Action: Craft (83)
// Action: Craft Five (84)
// Action: Craft All (85)
// Action: Clear Queue (86)
// Action: Transfer (87)
// Action: Drop (88)
// Action: Transfer Single (89)
// Action: Transfer Half (90)
// Action: Transfer All (91)
// Action: Take All Shortcut (92)
// Action: Sort Inventory (133)
// Action: Rotate Horizontal (93)
// Action: Rotate Vertical (94)
// Action: Zoom In (95)
// Action: Zoom Out (96)
// Action: Shortcuts Menu (99)
// Action: Open Mole Menu (100)
// Action: Apply and Close Mole Menu (101)
// Action: View Map (103)
// Action: Overhead Toggle Vertical Movement (105)
// Action: Toggle Perspective (106)
// Action: Edit Shotcut (107)
// Action: Open Hotbar Selection (108)
// Action: Swap Variation (109)
// Action: Strafe Up (110)
// Action: Strafe Down (111)
// Action: Toggle Overlay Mode (112)
// Action: Cycle Forward (113)
// Action: Cycle Backward (114)
// Action: Hotbar B 0 (115)
// Action: Hotbar B 1 (116)
// Action: Hotbar B 2 (117)
// Action: Hotbar B 3 (118)
// Action: Hotbar B 4 (119)
// Action: Hotbar B 5 (120)
// Action: Hotbar B 6 (121)
// Action: Hotbar B 7 (122)
// Action: Hotbar B 8 (123)
// Action: Hotbar B 9 (124)
// Action: Change Top Toolbar (125)
// Action: Change Bottom Toolbar (126)
// Action: Hotbar Edit 1 (127)
// Action: Hotbar Edit 2 (128)
// Action: Hotbar Edit Single (129)
// Action: Clear Shortcut (130)
// Action: Lock Toolbar (131)
// Action: Exit Hotbar (132)
// Action: MouseLeftClick (137)
// Action: MouseRightClick (138)
// Action: KB DatabankMenu (139)
// Action: KB Log Menu (140)
// Action: KB Journal Menu (141)
// Action: KB Map (150)
// Action: Quick Access (142)
// Action: UIPageLeftSecondary (143)
// Action: UIPageRightSecondary (144)
// Action: Frequency Select (145)
// Action: Frequency Step (146)
// Action: Frequency Pan (147)
// Action: UI Toggle Menu (151)

[HarmonyPatch]
class InputPatches
{
Expand Down Expand Up @@ -169,8 +64,8 @@ static void Move(PlayerFirstPersonController __instance)
}

var delta = Time.deltaTime;
var horizontalRotation = SteamVRInputMapper.TurnAxis * delta * 1f;
__instance.gameObject.transform.rotation = Quaternion.Euler(0, __instance.gameObject.transform.rotation.eulerAngles.y + horizontalRotation, 0);
var horizontalRotation = SteamVRInputMapper.TurnAxis * delta * 64f;
__instance.gameObject.transform.RotateAround(VRCameraManager.mainCamera.transform.position, Vector3.up, horizontalRotation);
}

[HarmonyPrefix]
Expand Down

0 comments on commit dd579c9

Please sign in to comment.