From 556f1779699d3f4bf36ff783e54c2077479a0fd7 Mon Sep 17 00:00:00 2001 From: 12090113 <47487266+12090113@users.noreply.github.com> Date: Wed, 29 Jun 2022 08:23:51 -0700 Subject: [PATCH] Add options to remove the look arrow, camera recentering, and the flashlight gesture (#512) * Added option to remove look arrow * Added option to disable moving the camera for preventing clipping * Added option to disable the flashlight gesture * Revert solution file versions Co-authored-by: artum --- NomaiVR/ModConfig/IModSettingProvider.cs | 3 +++ NomaiVR/ModConfig/ModSettings.cs | 3 +++ NomaiVR/ModConfig/OWMLSettingsProvider.cs | 6 ++++++ NomaiVR/ModConfig/default-config.json | 21 +++++++++++++++++++++ NomaiVR/Player/PlayerBodyPosition.cs | 2 +- NomaiVR/Tools/FlashlightGesture.cs | 5 ++++- NomaiVR/UI/LookArrow.cs | 3 ++- 7 files changed, 40 insertions(+), 3 deletions(-) diff --git a/NomaiVR/ModConfig/IModSettingProvider.cs b/NomaiVR/ModConfig/IModSettingProvider.cs index 3643935..9e59f1e 100644 --- a/NomaiVR/ModConfig/IModSettingProvider.cs +++ b/NomaiVR/ModConfig/IModSettingProvider.cs @@ -14,6 +14,9 @@ namespace NomaiVR.ModConfig bool EnableGesturePrompts { get; } bool EnableHandLaser { get; } bool EnableFeetMarker { get; } + bool EnableLookArrow { get; } + bool PreventClipping { get; } + bool FlashlightGesture { get; } bool ControllerOrientedMovement { get; } bool AutoHideToolbelt { get; } float ToolbeltHeight { get; } diff --git a/NomaiVR/ModConfig/ModSettings.cs b/NomaiVR/ModConfig/ModSettings.cs index b215d18..3d28793 100644 --- a/NomaiVR/ModConfig/ModSettings.cs +++ b/NomaiVR/ModConfig/ModSettings.cs @@ -16,6 +16,9 @@ namespace NomaiVR.ModConfig public static bool EnableGesturePrompts => settingsProvider.EnableGesturePrompts; public static bool EnableHandLaser => settingsProvider.EnableHandLaser; public static bool EnableFeetMarker => settingsProvider.EnableFeetMarker; + public static bool EnableLookArrow => settingsProvider.EnableLookArrow; + public static bool PreventClipping => settingsProvider.PreventClipping; + public static bool FlashlightGesture => settingsProvider.FlashlightGesture; public static bool ControllerOrientedMovement => settingsProvider.ControllerOrientedMovement; public static bool AutoHideToolbelt => settingsProvider.AutoHideToolbelt; public static float ToolbeltHeight => settingsProvider.ToolbeltHeight; diff --git a/NomaiVR/ModConfig/OWMLSettingsProvider.cs b/NomaiVR/ModConfig/OWMLSettingsProvider.cs index 954e268..cafc116 100644 --- a/NomaiVR/ModConfig/OWMLSettingsProvider.cs +++ b/NomaiVR/ModConfig/OWMLSettingsProvider.cs @@ -15,6 +15,9 @@ namespace NomaiVR.ModConfig public bool EnableGesturePrompts { get; private set; } public bool EnableHandLaser { get; private set; } public bool EnableFeetMarker { get; private set; } + public bool EnableLookArrow { get; private set; } + public bool PreventClipping { get; private set; } + public bool FlashlightGesture { get; private set; } public bool ControllerOrientedMovement { get; private set; } public bool AutoHideToolbelt { get; private set; } public float ToolbeltHeight { get; private set; } @@ -37,6 +40,9 @@ namespace NomaiVR.ModConfig EnableGesturePrompts = config.GetSettingsValue("showGesturePrompts"); EnableHandLaser = config.GetSettingsValue("showHandLaser"); EnableFeetMarker = config.GetSettingsValue("showFeetMarker"); + EnableLookArrow = config.GetSettingsValue("showLookArrow"); + FlashlightGesture = config.GetSettingsValue("flashlightGesture"); + PreventClipping = config.GetSettingsValue("preventClipping"); DebugMode = config.GetSettingsValue("debug"); AutoHideToolbelt = config.GetSettingsValue("autoHideToolbelt"); HudScale = config.GetSettingsValue("hudScale"); diff --git a/NomaiVR/ModConfig/default-config.json b/NomaiVR/ModConfig/default-config.json index 4c2390e..9a49121 100644 --- a/NomaiVR/ModConfig/default-config.json +++ b/NomaiVR/ModConfig/default-config.json @@ -85,6 +85,27 @@ "yes": "Show", "no": "Hide" }, + "showLookArrow": { + "type": "toggle", + "value": true, + "title": "Look arrow", + "yes": "Show", + "no": "Hide" + }, + "preventClipping": { + "type": "toggle", + "value": true, + "title": "Prevent clipping", + "yes": "Enabled", + "no": "Disabled" + }, + "flashlightGesture": { + "type": "toggle", + "value": true, + "title": "Flashlight gesture", + "yes": "Enabled", + "no": "Disabled" + }, "disableCursorLock": { "type": "toggle", "value": true, diff --git a/NomaiVR/Player/PlayerBodyPosition.cs b/NomaiVR/Player/PlayerBodyPosition.cs index 5ccbdf1..cff47c1 100644 --- a/NomaiVR/Player/PlayerBodyPosition.cs +++ b/NomaiVR/Player/PlayerBodyPosition.cs @@ -89,7 +89,7 @@ namespace NomaiVR.Player { var cameraToHead = Vector3.ProjectOnPlane(PlayerHelper.PlayerHead.position - playerCamera.transform.position, PlayerHelper.PlayerHead.up); - if (cameraToHead.sqrMagnitude > 0.5f) + if ((cameraToHead.sqrMagnitude > 0.5f && ModSettings.PreventClipping) || cameraToHead.sqrMagnitude > 10f) { MoveCameraToPlayerHead(); } diff --git a/NomaiVR/Tools/FlashlightGesture.cs b/NomaiVR/Tools/FlashlightGesture.cs index 121d747..82111e4 100644 --- a/NomaiVR/Tools/FlashlightGesture.cs +++ b/NomaiVR/Tools/FlashlightGesture.cs @@ -4,6 +4,7 @@ using NomaiVR.ReusableBehaviours; using System.Collections.Generic; using System.Linq; using UnityEngine; +using NomaiVR.ModConfig; namespace NomaiVR.Tools { @@ -55,7 +56,9 @@ namespace NomaiVR.Tools private void HandEnter(Transform hand) { - ControllerInput.SimulateInput(InputConsts.InputCommandType.FLASHLIGHT); + if (ModSettings.FlashlightGesture) { + ControllerInput.SimulateInput(InputConsts.InputCommandType.FLASHLIGHT); + } } } } diff --git a/NomaiVR/UI/LookArrow.cs b/NomaiVR/UI/LookArrow.cs index 7f043ff..34d4044 100644 --- a/NomaiVR/UI/LookArrow.cs +++ b/NomaiVR/UI/LookArrow.cs @@ -1,6 +1,7 @@ using System.Linq; using NomaiVR.Assets; using NomaiVR.Helpers; +using NomaiVR.ModConfig; using UnityEngine; namespace NomaiVR.UI @@ -64,7 +65,7 @@ namespace NomaiVR.UI private void UpdateArrow() { - if (target == null) + if (target == null || !ModSettings.EnableLookArrow) { HideArrow(); return;