Skip to content

Commit

Permalink
Performance improvement when using Shoulder/Spine/Toe FK Adjustment H…
Browse files Browse the repository at this point in the history
…ints
  • Loading branch information
OrangeSpork committed Jul 22, 2021
1 parent b3758ef commit 714cc4e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
13 changes: 13 additions & 0 deletions AdvIKPlugin/AdvIKCharaController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
using Studio;
using AdvIKPlugin.Algos;
using KKABMX.Core;
using System.Collections.Generic;

namespace AdvIKPlugin
{
Expand Down Expand Up @@ -727,22 +728,34 @@ public Transform FindRToeBone()

public Transform FindDescendant(Transform start, string name)
{
if (boneCache.TryGetValue(name, out Transform descendant))
return descendant;

if (start == null)
{
return null;
}

if (start.name.Equals(name))
{
boneCache.Add(name, start);
return start;
}
foreach (Transform t in start)
{
Transform res = FindDescendant(t, name);
if (res != null)
{
if (!boneCache.ContainsKey(name))
boneCache.Add(name, res);
return res;
}
}
return null;
}

private Dictionary<string, Transform> boneCache = new Dictionary<string, Transform>();

System.Random rand = new System.Random();
private double randomGaussian(double mean, double stdDev)
{
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.6.2";
public const string Version = "1.6.3";

public static AdvIKPlugin Instance { get; set; }

Expand Down

0 comments on commit 714cc4e

Please sign in to comment.