Fixes following nanobrain update
This commit is contained in:
parent
26ef665634
commit
fa8cd1c728
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -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();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user