Reorder NaN check
This commit is contained in:
@@ -119,9 +119,6 @@ public class LogicAI extends AIController{
|
|||||||
|
|
||||||
vec.set(target).sub(unit);
|
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);
|
float length = circleLength <= 0.001f ? 1f : Mathf.clamp((unit.dst(target) - circleLength) / smooth, -1f, 1f);
|
||||||
|
|
||||||
vec.setLength(unit.realSpeed() * length);
|
vec.setLength(unit.realSpeed() * length);
|
||||||
@@ -131,6 +128,9 @@ public class LogicAI extends AIController{
|
|||||||
vec.setZero();
|
vec.setZero();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//do not move when infinite vectors are used.
|
||||||
|
if(vec.isNaN() || vec.isInfinite()) return;
|
||||||
|
|
||||||
unit.approach(vec);
|
unit.approach(vec);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user