From a785fd5c1a79a70de941bc342fb9c8f9eb446dc5 Mon Sep 17 00:00:00 2001 From: Justin Oros Date: Sun, 27 Sep 2026 13:21:21 -0700 Subject: [PATCH] Make trim and windage angular so they hold at every range --- README.md | 3 +++ RifleScope.cs | 6 ++++-- RifleScope.csproj | 2 +- manifest.json | 2 +- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 43f43b1..35d2aea 100644 --- a/README.md +++ b/README.md @@ -75,6 +75,9 @@ Press F1 to open the console, then use these commands: | `scopewind 20` | Set the windage, -200 to 200. Positive moves hits right, negative moves hits left. The default is 0 | | `scopedebug` | Toggle a debug readout above the range | +Trim and windage are angle adjustments, so a setting that is right at one range +stays right at every range. + The zoom, trim and windage are saved to `UserData\RifleScope.txt` in your game folder. Setting the zoom to 1 keeps vanilla zoom and the normal scope view, without the red dot. diff --git a/RifleScope.cs b/RifleScope.cs index 0786384..aa27a58 100644 --- a/RifleScope.cs +++ b/RifleScope.cs @@ -23,6 +23,7 @@ public class RifleScope : SonsMod private const float DefaultTrimCm = 50f; private const float MaxTrimCm = 200f; private const float MaxWindCm = 200f; + private const float TrimReferenceRange = 50f; private const int MilDotCount = 10; private const float MilDotSize = 0.4f; private const float MinDotPx = 7f; @@ -196,8 +197,9 @@ public class RifleScope : SonsMod } CenterPoint(cam, out var point); - point -= cam.transform.up * (_trimCm * 0.01f); - point += cam.transform.right * (_windCm * 0.01f); + var scale = Vector3.Distance(cam.transform.position, point) / TrimReferenceRange; + point -= cam.transform.up * (_trimCm * 0.01f * scale); + point += cam.transform.right * (_windCm * 0.01f * scale); var dir = point - _projectile.position; if (dir.sqrMagnitude < 0.0001f) return; diff --git a/RifleScope.csproj b/RifleScope.csproj index 6d7b41c..a35b3cb 100644 --- a/RifleScope.csproj +++ b/RifleScope.csproj @@ -6,7 +6,7 @@ latest RifleScope RifleScope - 1.0.0 + 1.0.1 CS0436;CS1701;CS1702;MSB3277;MSB3106 diff --git a/manifest.json b/manifest.json index 9cbd53c..968389c 100644 --- a/manifest.json +++ b/manifest.json @@ -3,7 +3,7 @@ "id": "RifleScope", "name": "RifleScope", "author": "JustinOros", - "version": "1.0.0", + "version": "1.0.1", "description": "Stronger rifle scope magnification and a crosshair reticle", "gameVersion": "1.0.0", "platform": "Client",