UBOAT
Compass Navigation
DECAFBAD 2 Nov, 2022 @ 1:19pm
Compass turns too fast
Inner disc shows the degrees, not tenths of degrees. The mod is wrong.

This patch fixes the bug:

diff --git a/Source/GyroCompassControl/GyroCompassControler.cs b/Source/GyroCompassControl/GyroCompassControler.cs index 09a968e..76ca493 100755 --- a/Source/GyroCompassControl/GyroCompassControler.cs +++ b/Source/GyroCompassControl/GyroCompassControler.cs @@ -43,11 +43,12 @@ namespace UBOAT.Mods.Couaky.CompassNavigation { } void Update () { - int angleInt = Mathf.FloorToInt(currentBearingAngle); + int angleInt = Mathf.FloorToInt(currentBearingAngle); // 352.1 -> 352^M + int roundDownToTen = 10*Mathf.FloorToInt(currentBearingAngle/10); // 352.1 -> 350^M // Update repeaters positions externalDisk.eulerAngles = new Vector3(0.0f, 0.0f, (currentBearingAngle + externalDiskOffset)); - internalDisk.eulerAngles = new Vector3(0.0f, 0.0f, (currentBearingAngle - angleInt) * 360.0f + internalDiskOffset); + internalDisk.eulerAngles = new Vector3(0.0f, 0.0f, (currentBearingAngle - roundDownToTen) * 36.0f + internalDiskOffset); // 352.1 -> 2.1^M // Update target bearing and angle indicator if (selectedBearingAngleEnabled) {
< >
Showing 1-8 of 8 comments
Eridano2013 7 Nov, 2022 @ 5:03am 
Compass turns too fast for me too: how can I patch it with the code provided by @DECAFBAD?
DECAFBAD 7 Nov, 2022 @ 5:36am 
The patch above is for git but you can use it manually:

Find and open the file in the mod's folder named GyroCompassControler.cs in a text editor

You'll have to add the lines starting with +
and remove the linesstarting with a -
AlexFoyle 25 Nov, 2022 @ 2:56pm 
Thank you very much DECAFBAD! Indeed this is correct and, I would add, more aesthetically relaxing!

Just a little tweak, but I would also change:

int angleInt = Mathf.FloorToInt(currentBearingAngle);

to:

int angleInt = Mathf.RoundToInt(currentBearingAngle);

so the digital bearing display is a closer approximation (eg. 310.9 degrees is rounded to 311 and displayed as such, instead of the current 310) and also nicer to look at while you're turning in my opinion...
DECAFBAD 25 Nov, 2022 @ 4:24pm 
LOL I have it set up exactly like that.

One more change:
In Source/GyroCompassControl/ShipControlGUIPatch.cs
set
selectedBearing = Mathf.Repeat(selectedBearing, 360.0f);

to

selectedBearing = Mathf.Round(Mathf.Repeat(selectedBearing, 360.0f));

This will keep the boat headed towards an exact course that you ordered instead of approximate course where your mouse pointer happened to be.
AlexFoyle 25 Nov, 2022 @ 4:28pm 
Ah cool! By exact you mean the integer degrees value shown in the digital display, right? So 273° instead of 273.3° or 272.8°?
DECAFBAD 25 Nov, 2022 @ 4:29pm 
Exactly :)
Vlad Draculea 29 Nov, 2022 @ 8:39am 
im not sure if the changes im making are correct, can you just send a .txt file so we can copy paste its contents to the GyroCompassControler.cs
DECAFBAD 29 Nov, 2022 @ 8:47am 
Unfortunately I can not do that.
< >
Showing 1-8 of 8 comments
Per page: 1530 50