diff --git a/CreatureControl/Runtime/Scripts/CreatureAnimator.cs b/CreatureControl/Runtime/Scripts/CreatureAnimator.cs index 90acd3a..07a47ea 100644 --- a/CreatureControl/Runtime/Scripts/CreatureAnimator.cs +++ b/CreatureControl/Runtime/Scripts/CreatureAnimator.cs @@ -1,7 +1,6 @@ using System.Collections.Generic; using UnityEngine; using UnityEditor.Animations; -using LinearAlgebra; namespace CreatureControl { @@ -102,7 +101,7 @@ namespace CreatureControl { this.animator.SetFloat("Right", rightAnimationSpeed); Quaternion rotation = this.transform.rotation * Quaternion.Inverse(lastOrientation); - float rotationAngleY = Angles.Normalize(rotation.eulerAngles.y); + float rotationAngleY = AnglesNormalize(rotation.eulerAngles.y); float rotationSpeed = rotationAngleY / Time.deltaTime; float rotAnimationSpeed = rotationSpeed / rootMotionScaleRotate; this.animator.SetFloat("Rotation", rotAnimationSpeed); @@ -111,6 +110,14 @@ namespace CreatureControl { lastOrientation = this.transform.rotation; } + float AnglesNormalize(float angle) { + if (float.IsInfinity(angle)) + return angle; + + while (angle <= -180) angle += 360; + while (angle > 180) angle -= 360; + return angle; + } } } \ No newline at end of file diff --git a/NanoBrain/Runtime/Scripts/Core/Cluster.cs b/NanoBrain/Runtime/Scripts/Core/Cluster.cs index 2d5a1f7..8779e03 100644 --- a/NanoBrain/Runtime/Scripts/Core/Cluster.cs +++ b/NanoBrain/Runtime/Scripts/Core/Cluster.cs @@ -504,9 +504,6 @@ namespace NanoBrain { public void RefreshComputeOrders() { this._computeOrders = null; } - public void RefreshComputeOrders() { - this._computeOrders = null; - } private List TopologicalSort2(Nucleus startNode) { Dictionary inDegree = new();