Skip to content

Commit 7584663

Browse files
committed
[RealPOV] Add setting for each offset axis
1 parent 07f6d61 commit 7584663

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

src/RealPOV.Core.Koikatu/RealPOV.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ protected override void Awake()
3939
{
4040
plugin = this;
4141
defaultFov = 45f;
42-
defaultViewOffset = 0.05f;
4342
base.Awake();
4443

4544
HideHead = Config.Bind(SECTION_GENERAL, "Hide character head", false, "When entering POV, hide the character's head. Prevents accessories and hair from obstructing the view.");
@@ -228,7 +227,7 @@ private static bool ApplyRotation(NeckLookControllerVer2 __instance)
228227
var eyeObjs = currentChara.eyeLookCtrl.eyeLookScript.eyeObjs;
229228
var pos = Vector3.Lerp(eyeObjs[0].eyeTransform.position, eyeObjs[1].eyeTransform.position, 0.5f);
230229
GameCamera.transform.SetPositionAndRotation(pos, currentChara.objHeadBone.transform.rotation);
231-
GameCamera.transform.Translate(Vector3.forward * ViewOffset.Value);
230+
GameCamera.transform.Translate(ViewOffsetX.Value, ViewOffsetY.Value, ViewOffsetZ.Value);
232231
if (CurrentFOV == null) throw new InvalidOperationException("CurrentFOV == null");
233232
GameCamera.fieldOfView = CurrentFOV.Value;
234233

src/RealPOV.Core/RealPOVCore.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ public abstract class RealPOVCore : BaseUnityPlugin
1414
protected const string SECTION_GENERAL = "General";
1515
protected const string SECTION_HOTKEYS = "Keyboard shortcuts";
1616

17-
internal static ConfigEntry<float> ViewOffset { get; set; }
17+
internal static ConfigEntry<float> ViewOffsetZ { get; set; }
18+
internal static ConfigEntry<float> ViewOffsetY { get; set; }
19+
internal static ConfigEntry<float> ViewOffsetX { get; set; }
1820
internal static ConfigEntry<float> DefaultFOV { get; set; }
1921
internal static ConfigEntry<float> MouseSens { get; set; }
2022
internal static ConfigEntry<KeyboardShortcut> POVHotkey { get; set; }
@@ -24,7 +26,6 @@ public abstract class RealPOVCore : BaseUnityPlugin
2426
protected static readonly Dictionary<GameObject, Vector3> LookRotation = new Dictionary<GameObject, Vector3>();
2527
protected static GameObject currentCharaGo;
2628
protected static Camera GameCamera;
27-
protected static float defaultViewOffset = 0.03f;
2829
protected static float defaultFov = 70f;
2930

3031
private static float backupFOV;
@@ -40,7 +41,9 @@ protected virtual void Awake()
4041
POVHotkey = Config.Bind(SECTION_HOTKEYS, "Toggle POV", new KeyboardShortcut(KeyCode.Backspace));
4142
DefaultFOV = Config.Bind(SECTION_GENERAL, "Default FOV", defaultFov, new ConfigDescription("", new AcceptableValueRange<float>(20f, 120f)));
4243
MouseSens = Config.Bind(SECTION_GENERAL, "Mouse sensitivity", 1f, new ConfigDescription("", new AcceptableValueRange<float>(0.1f, 2f)));
43-
ViewOffset = Config.Bind(SECTION_GENERAL, "View offset", defaultViewOffset, new ConfigDescription("Move the camera backward or forward", new AcceptableValueRange<float>(-0.5f, 0.5f)));
44+
ViewOffsetZ = Config.Bind(SECTION_GENERAL, "View offset Z", 0f, new ConfigDescription("Move the camera backward or forward", new AcceptableValueRange<float>(-0.5f, 0.5f)));
45+
ViewOffsetY = Config.Bind(SECTION_GENERAL, "View offset Y", 0f, new ConfigDescription("Move the camera up or down", new AcceptableValueRange<float>(-0.5f, 0.5f)));
46+
ViewOffsetX = Config.Bind(SECTION_GENERAL, "View offset X", 0f, new ConfigDescription("Move the camera left or right", new AcceptableValueRange<float>(-0.5f, 0.5f)));
4447
}
4548

4649
private void Update()

0 commit comments

Comments
 (0)