Fixed #5699
This commit is contained in:
@@ -102,7 +102,7 @@ public class LogicAI extends AIController{
|
|||||||
}
|
}
|
||||||
|
|
||||||
//look where moving if there's nothing to aim at
|
//look where moving if there's nothing to aim at
|
||||||
if(!shoot){
|
if(!shoot || !unit.type.omniMovement){
|
||||||
unit.lookAt(unit.prefRotation());
|
unit.lookAt(unit.prefRotation());
|
||||||
}else if(unit.hasWeapons() && unit.mounts.length > 0 && !unit.mounts[0].weapon.ignoreRotation){ //if there is, look at the object
|
}else if(unit.hasWeapons() && unit.mounts.length > 0 && !unit.mounts[0].weapon.ignoreRotation){ //if there is, look at the object
|
||||||
unit.lookAt(unit.mounts[0].aimX, unit.mounts[0].aimY);
|
unit.lookAt(unit.mounts[0].aimX, unit.mounts[0].aimY);
|
||||||
@@ -131,7 +131,13 @@ public class LogicAI extends AIController{
|
|||||||
//do not move when infinite vectors are used.
|
//do not move when infinite vectors are used.
|
||||||
if(vec.isNaN() || vec.isInfinite()) return;
|
if(vec.isNaN() || vec.isInfinite()) return;
|
||||||
|
|
||||||
unit.approach(vec);
|
if(unit.type.omniMovement){
|
||||||
|
unit.approach(vec);
|
||||||
|
}else{
|
||||||
|
unit.rotateMove(vec);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -59,6 +59,14 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I
|
|||||||
vel.approachDelta(vector, type.accel * realSpeed());
|
vel.approachDelta(vector, type.accel * realSpeed());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void rotateMove(Vec2 vec){
|
||||||
|
moveAt(Tmp.v2.trns(rotation, vec.len()));
|
||||||
|
|
||||||
|
if(!vec.isZero()){
|
||||||
|
rotation = Angles.moveToward(rotation, vec.angle(), type.rotateSpeed * Math.max(Time.delta, 1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void aimLook(Position pos){
|
public void aimLook(Position pos){
|
||||||
aim(pos);
|
aim(pos);
|
||||||
lookAt(pos);
|
lookAt(pos);
|
||||||
|
|||||||
@@ -645,6 +645,8 @@ public class DesktopInput extends InputHandler{
|
|||||||
if(omni){
|
if(omni){
|
||||||
unit.moveAt(movement);
|
unit.moveAt(movement);
|
||||||
}else{
|
}else{
|
||||||
|
unit.rotateMove(movement);
|
||||||
|
|
||||||
unit.moveAt(Tmp.v2.trns(unit.rotation, movement.len()));
|
unit.moveAt(Tmp.v2.trns(unit.rotation, movement.len()));
|
||||||
|
|
||||||
//problem: actual unit rotation is controlled by velocity, but velocity is 1) unpredictable and 2) can be set to 0
|
//problem: actual unit rotation is controlled by velocity, but velocity is 1) unpredictable and 2) can be set to 0
|
||||||
|
|||||||
@@ -922,10 +922,7 @@ public class MobileInput extends InputHandler implements GestureListener{
|
|||||||
if(omni){
|
if(omni){
|
||||||
unit.moveAt(movement);
|
unit.moveAt(movement);
|
||||||
}else{
|
}else{
|
||||||
unit.moveAt(Tmp.v2.trns(unit.rotation, movement.len()));
|
unit.rotateMove(movement);
|
||||||
if(!movement.isZero()){
|
|
||||||
unit.rotation = Angles.moveToward(unit.rotation, movement.angle(), unit.type.rotateSpeed * Math.max(Time.delta, 1));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//update shooting if not building + not mining
|
//update shooting if not building + not mining
|
||||||
|
|||||||
Reference in New Issue
Block a user