Fixes following nanobrain update

This commit is contained in:
Pascal Serrarens 2026-05-07 15:33:45 +02:00
parent 26ef665634
commit fa8cd1c728
2 changed files with 9 additions and 5 deletions

View File

@ -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;
}
}
}

View File

@ -504,9 +504,6 @@ namespace NanoBrain {
public void RefreshComputeOrders() {
this._computeOrders = null;
}
public void RefreshComputeOrders() {
this._computeOrders = null;
}
private List<Nucleus> TopologicalSort2(Nucleus startNode) {
Dictionary<Nucleus, int> inDegree = new();