Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions GameData/KSPCommunityFixes/Settings.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,11 @@ KSP_COMMUNITY_FIXES
// Fix the Alt+F12 console input field stealing input when a console entry is added
DebugConsoleDontStealInput = true

// Fix the hard-coded lower limit for the moment of inertia of wheels being too large (0.01 t*m^2) and
// causing incorrectly large forces on small aircraft during touchdown. This fix should prevent your craft from
// pitching up or down unexpectedly when touching down.
WheelInertiaLimit = true

// ##########################
// Obsolete bugfixes
// ##########################
Expand Down
30 changes: 30 additions & 0 deletions KSPCommunityFixes/BugFixes/WheelInertiaLimit.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using System;
using System.Collections.Generic;
using HarmonyLib;
using VehiclePhysics;
using UnityEngine;

namespace KSPCommunityFixes
{
public class WheelInertiaLimit : BasePatch
{
protected override Version VersionMin => new Version(1, 12, 0);

protected override void ApplyPatches()
{
AddPatch(PatchType.Postfix, typeof(VehiclePhysics.Wheel), nameof(VehiclePhysics.Wheel.RecalculateConstants));
}

static void Wheel_RecalculateConstants_Postfix(VehiclePhysics.Wheel __instance)
{
__instance.I = __instance.mass * __instance.radius * __instance.radius * 0.5f;

if (__instance.I < 0.00001f)
{
__instance.I = 0.00001f;
}

__instance.invI = 1f / __instance.I;
}
}
}
1 change: 1 addition & 0 deletions KSPCommunityFixes/KSPCommunityFixes.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@
<Compile Include="BugFixes\ChutePhantomSymmetry.cs" />
<Compile Include="BugFixes\CorrectDragForFlags.cs" />
<Compile Include="BugFixes\DebugConsoleDontStealInput.cs" />
<Compile Include="BugFixes\WheelInertiaLimit.cs" />
<Compile Include="BugFixes\DragCubeLoadException.cs" />
<Compile Include="BugFixes\EVAConstructionMass.cs" />
<Compile Include="BugFixes\FastAndFixedEnumExtensions.cs" />
Expand Down