Fixed avoidance layering
This commit is contained in:
@@ -60,13 +60,10 @@ public class AvoidanceProcess implements AsyncProcess{
|
||||
//only do avoidance if it's relevant to the team
|
||||
if(team.team.isAI() && !team.team.rules().rtsAi){
|
||||
for(var unit : team.units){
|
||||
if(!unit.isFlying()){
|
||||
int layer = unit.collisionLayer();
|
||||
if(layer < PhysicsProcess.layers){
|
||||
//scaling is oversized 2x because units need to avoid things that are at their origin tile
|
||||
float scaling = 2f;
|
||||
requests.add(Point2.pack(unit.tileX(), unit.tileY()), Float.floatToRawIntBits(unit.hitSize * unitCollisionRadiusScale / tilesize * scaling), unit.id);
|
||||
}
|
||||
if(unit.collisionLayer() == PhysicsProcess.layerGround){
|
||||
//scaling is oversized 2x because units need to avoid things that are at their origin tile
|
||||
float scaling = 2f;
|
||||
requests.add(Point2.pack(unit.tileX(), unit.tileY()), Float.floatToRawIntBits(unit.hitSize * unitCollisionRadiusScale / tilesize * scaling), unit.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user