Reorder NaN check

This commit is contained in:
Anuken
2021-02-15 11:00:49 -05:00
parent a2e5dae27f
commit 4bbb4b9a19

View File

@@ -119,9 +119,6 @@ public class LogicAI extends AIController{
vec.set(target).sub(unit);
//do not move when infinite vectors are used.
if(vec.isNaN() || vec.isInfinite()) return;
float length = circleLength <= 0.001f ? 1f : Mathf.clamp((unit.dst(target) - circleLength) / smooth, -1f, 1f);
vec.setLength(unit.realSpeed() * length);
@@ -131,6 +128,9 @@ public class LogicAI extends AIController{
vec.setZero();
}
//do not move when infinite vectors are used.
if(vec.isNaN() || vec.isInfinite()) return;
unit.approach(vec);
}