From 462201534d2e7904829609ac7913f7edd5ad388e Mon Sep 17 00:00:00 2001 From: originalnicodr Date: Tue, 26 Nov 2024 20:44:17 -0300 Subject: [PATCH] Added option to reset the freecam transform between freecam sessions. --- src/Config/ConfigManager.cs | 5 +++++ src/Loader/Standalone/Editor/ExplorerEditorBehaviour.cs | 6 ++++++ src/UI/Panels/FreeCamPanel.cs | 2 +- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/Config/ConfigManager.cs b/src/Config/ConfigManager.cs index 8de4c8e..62c1be5 100644 --- a/src/Config/ConfigManager.cs +++ b/src/Config/ConfigManager.cs @@ -31,6 +31,7 @@ namespace UnityExplorer.Config public static ConfigElement Reflection_Signature_Blacklist; public static ConfigElement Reflection_Hide_NativeInfoPtrs; public static ConfigElement Auto_Scale_UI; + public static ConfigElement Reset_Camera_Transform; public static ConfigElement Default_Freecam; public static ConfigElement Pause; @@ -185,6 +186,10 @@ namespace UnityExplorer.Config Auto_Scale_UI = new("Make the mod UI automatically scale with resolution", "Especially useful when running games in high resolutions and you are having a hard time reading the mods menu (requires restart).", true); + + Reset_Camera_Transform = new("Reset Camera transform on freecam disable", + "Reset the camera position and rotation between freecam sessions, so the freecam always starts from the gameplay position and rotation.", + false); Default_Freecam = new("Default Freecam mode", "Default type of freecam selected on startup.", diff --git a/src/Loader/Standalone/Editor/ExplorerEditorBehaviour.cs b/src/Loader/Standalone/Editor/ExplorerEditorBehaviour.cs index 1c47ca0..18ff8f1 100644 --- a/src/Loader/Standalone/Editor/ExplorerEditorBehaviour.cs +++ b/src/Loader/Standalone/Editor/ExplorerEditorBehaviour.cs @@ -26,6 +26,9 @@ namespace UnityExplorer.Loader.Standalone public bool Force_Unlock_Mouse = true; public KeyCode Force_Unlock_Toggle; public bool Disable_EventSystem_Override; + public bool Auto_Scale_UI; + public bool Reset_Camera_Transform; + public FreeCamPanel.FreeCameraType Default_Freecam; public KeyCode Pause; public KeyCode Frameskip; @@ -80,6 +83,9 @@ namespace UnityExplorer.Loader.Standalone ConfigManager.Force_Unlock_Mouse.Value = this.Force_Unlock_Mouse; ConfigManager.Force_Unlock_Toggle.Value = this.Force_Unlock_Toggle; ConfigManager.Disable_EventSystem_Override.Value = this.Disable_EventSystem_Override; + ConfigManager.Auto_Scale_UI.Value = this.Auto_Scale_UI; + ConfigManager.Reset_Camera_Transform.Value = this.Reset_Camera_Transform; + ConfigManager.Default_Freecam.Value = this.Default_Freecam; ConfigManager.Pause.Value = this.Pause; ConfigManager.Frameskip.Value = this.Frameskip; diff --git a/src/UI/Panels/FreeCamPanel.cs b/src/UI/Panels/FreeCamPanel.cs index ed5b9bb..cf54118 100644 --- a/src/UI/Panels/FreeCamPanel.cs +++ b/src/UI/Panels/FreeCamPanel.cs @@ -243,7 +243,7 @@ namespace UnityExplorer.UI.Panels ourCamera.enabled = true; string currentScene = SceneManager.GetActiveScene().name; - if (lastScene != currentScene){ + if (lastScene != currentScene || ConfigManager.Reset_Camera_Transform.Value){ OnResetPosButtonClicked(); } lastScene = currentScene;