Skip to content

Commit

Permalink
Fix neck motion in KK/KKS. Retuned default neck motion in HS2/AI.
Browse files Browse the repository at this point in the history
  • Loading branch information
OrangeSpork committed Feb 12, 2022
1 parent a8ce68d commit bae72a9
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 7 deletions.
4 changes: 2 additions & 2 deletions AI_AdvIKPlugin/AI_AdvIKPlugin.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\bin\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DefineConstants>TRACE;DEBUG;AI</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
Expand All @@ -29,7 +29,7 @@
<DebugType>none</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\bin\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<DefineConstants>TRACE;AI</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
Expand Down
8 changes: 8 additions & 0 deletions AdvIKPlugin/AdvIKGUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -699,6 +699,14 @@ public static void SetupBreathShapeControls()
}
});

#if KOIKATSU || KKS
// KK Skeleton does not require neck adjustments for upper chest movement as the upper chest has a different scaling center system.

neckMotionSliderText.gameObject.SetActive(false);
NeckMotionSlider.gameObject.SetActive(false);

#endif

// Clear controls
foreach (Transform child in BreathShapePanel.transform)
{
Expand Down
7 changes: 6 additions & 1 deletion AdvIKPlugin/AdvIKHooks.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
using HarmonyLib;
#if !KKS && !KOIKATSU
using AIChara;
#endif
using HarmonyLib;
using IllusionUtility.GetUtility;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;

namespace AdvIKPlugin
{
Expand Down
2 changes: 1 addition & 1 deletion AdvIKPlugin/AdvIKPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public partial class AdvIKPlugin : BaseUnityPlugin
{
public const string GUID = "orange.spork.advikplugin";
public const string PluginName = "AdvIKPlugin";
public const string Version = "1.7.0";
public const string Version = "1.7.1";

public static AdvIKPlugin Instance { get; set; }

Expand Down
7 changes: 6 additions & 1 deletion AdvIKPlugin/Algos/BreathingBoneEffect.cs
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ public override BoneModifierData GetEffect(string bone, BoneController origin, C
newUpperChestPos.z = ((1 + newUpperChestPos.z) * appliedUpperBreathScale.z) - ((1 + newUpperChestPos.z));
newUpperChestPos.y = ((1 + newUpperChestPos.y) * appliedUpperBreathScale.y) - ((1 + newUpperChestPos.y));

Vector3 newNeckPos = new Vector3(0, newUpperChestPos.y + (newUpperChestPos.y * NeckMotionDampeningFactor), 0);
Vector3 newNeckPos = new Vector3(0, (newUpperChestPos.y * NeckMotionDampeningFactor), 0);

// Same with lower chest
Vector3 newLowerChestPos = new Vector3(0, 0, 0);
Expand Down Expand Up @@ -285,12 +285,17 @@ public override BoneModifierData GetEffect(string bone, BoneController origin, C
}
else if (bone.Equals(Neck))
{
#if KOIKATSU || KKS
// Upper Chest doesn't move in KK so this isn't needed/useful.
return null;
#else
// Looks like applying a 0 position offset to a bone with a length adjustment causes ABMX to incorrectly revert the length adjustment
// Work around by supplying a very small position offset instead
if (FrameEffects.NeckAdj.y == 0)
return UpdateBoneModifier(bone, Vector3.one, new Vector3(0f, 0.001f, 0f));
else
return UpdateBoneModifier(bone, Vector3.one, FrameEffects.NeckAdj);
#endif
}
else
{
Expand Down
5 changes: 3 additions & 2 deletions HS2_AdvIKPlugin/HS2_AdvIKPlugin.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,18 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\bin\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DefineConstants>TRACE;DEBUG;HS2</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>none</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\bin\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<DefineConstants>TRACE;HS2</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<ItemGroup>
<Reference Include="0Harmony, Version=2.2.0.0, Culture=neutral, processorArchitecture=MSIL">
Expand Down

0 comments on commit bae72a9

Please sign in to comment.