UBOAT
Compass Navigation
DECAFBAD 2022 年 11 月 2 日 下午 1:19
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) {
< >
正在显示第 1 - 8 条,共 8 条留言
Eridano2013 2022 年 11 月 7 日 上午 5:03 
Compass turns too fast for me too: how can I patch it with the code provided by @DECAFBAD?
DECAFBAD 2022 年 11 月 7 日 上午 5:36 
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 2022 年 11 月 25 日 下午 2:56 
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 2022 年 11 月 25 日 下午 4:24 
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 2022 年 11 月 25 日 下午 4:28 
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 2022 年 11 月 25 日 下午 4:29 
Exactly :)
Vlad Draculea 2022 年 11 月 29 日 上午 8:39 
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 2022 年 11 月 29 日 上午 8:47 
Unfortunately I can not do that.
< >
正在显示第 1 - 8 条,共 8 条留言
每页显示数: 1530 50