Make trim and windage angular so they hold at every range
This commit is contained in:
1 parent
1a81bdc552
commit
a785fd5c1a
4 files changed
+9
-4
No files matched your search
@@ -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 |
|
| `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 |
|
| `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
|
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,
|
folder. Setting the zoom to 1 keeps vanilla zoom and the normal scope view,
|
||||||
without the red dot.
|
without the red dot.
|
||||||
|
|||||||
+4
-2
@@ -23,6 +23,7 @@ public class RifleScope : SonsMod
|
|||||||
private const float DefaultTrimCm = 50f;
|
private const float DefaultTrimCm = 50f;
|
||||||
private const float MaxTrimCm = 200f;
|
private const float MaxTrimCm = 200f;
|
||||||
private const float MaxWindCm = 200f;
|
private const float MaxWindCm = 200f;
|
||||||
|
private const float TrimReferenceRange = 50f;
|
||||||
private const int MilDotCount = 10;
|
private const int MilDotCount = 10;
|
||||||
private const float MilDotSize = 0.4f;
|
private const float MilDotSize = 0.4f;
|
||||||
private const float MinDotPx = 7f;
|
private const float MinDotPx = 7f;
|
||||||
@@ -196,8 +197,9 @@ public class RifleScope : SonsMod
|
|||||||
}
|
}
|
||||||
|
|
||||||
CenterPoint(cam, out var point);
|
CenterPoint(cam, out var point);
|
||||||
point -= cam.transform.up * (_trimCm * 0.01f);
|
var scale = Vector3.Distance(cam.transform.position, point) / TrimReferenceRange;
|
||||||
point += cam.transform.right * (_windCm * 0.01f);
|
point -= cam.transform.up * (_trimCm * 0.01f * scale);
|
||||||
|
point += cam.transform.right * (_windCm * 0.01f * scale);
|
||||||
var dir = point - _projectile.position;
|
var dir = point - _projectile.position;
|
||||||
if (dir.sqrMagnitude < 0.0001f)
|
if (dir.sqrMagnitude < 0.0001f)
|
||||||
return;
|
return;
|
||||||
|
|||||||
+1
-1
@@ -6,7 +6,7 @@
|
|||||||
<LangVersion>latest</LangVersion>
|
<LangVersion>latest</LangVersion>
|
||||||
<AssemblyName>RifleScope</AssemblyName>
|
<AssemblyName>RifleScope</AssemblyName>
|
||||||
<RootNamespace>RifleScope</RootNamespace>
|
<RootNamespace>RifleScope</RootNamespace>
|
||||||
<Version>1.0.0</Version>
|
<Version>1.0.1</Version>
|
||||||
<NoWarn>CS0436;CS1701;CS1702;MSB3277;MSB3106</NoWarn>
|
<NoWarn>CS0436;CS1701;CS1702;MSB3277;MSB3106</NoWarn>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -3,7 +3,7 @@
|
|||||||
"id": "RifleScope",
|
"id": "RifleScope",
|
||||||
"name": "RifleScope",
|
"name": "RifleScope",
|
||||||
"author": "JustinOros",
|
"author": "JustinOros",
|
||||||
"version": "1.0.0",
|
"version": "1.0.1",
|
||||||
"description": "Stronger rifle scope magnification and a crosshair reticle",
|
"description": "Stronger rifle scope magnification and a crosshair reticle",
|
||||||
"gameVersion": "1.0.0",
|
"gameVersion": "1.0.0",
|
||||||
"platform": "Client",
|
"platform": "Client",
|
||||||
|
|||||||
Reference in new issue
Block a user